diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-12-03 12:46:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-03 12:46:43 +0100 |
commit | 101b935de4852308a238c04bf5a08d01a6ebe45c (patch) | |
tree | 37ac469f7b391531a10044abaa06864fe4ac24a8 /application/HttpUtils.php | |
parent | 877491b4ad0a6a9119e667901cef40cc56116901 (diff) | |
parent | 8e9fc6f6e6afc052a2c3b2d459764cc9ab20420a (diff) | |
download | Shaarli-101b935de4852308a238c04bf5a08d01a6ebe45c.tar.gz Shaarli-101b935de4852308a238c04bf5a08d01a6ebe45c.tar.zst Shaarli-101b935de4852308a238c04bf5a08d01a6ebe45c.zip |
Merge pull request #1025 from ArthurHoaro/hotfix/proxy-443
Force HTTPS if the original port is 443 behind a reverse proxy
Diffstat (limited to 'application/HttpUtils.php')
-rw-r--r-- | application/HttpUtils.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/application/HttpUtils.php b/application/HttpUtils.php index ec54dcd4..c9371b55 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php | |||
@@ -302,6 +302,13 @@ function server_url($server) | |||
302 | $port = $server['HTTP_X_FORWARDED_PORT']; | 302 | $port = $server['HTTP_X_FORWARDED_PORT']; |
303 | } | 303 | } |
304 | 304 | ||
305 | // This is a workaround for proxies that don't forward the scheme properly. | ||
306 | // Connecting over port 443 has to be in HTTPS. | ||
307 | // See https://github.com/shaarli/Shaarli/issues/1022 | ||
308 | if ($port == '443') { | ||
309 | $scheme = 'https'; | ||
310 | } | ||
311 | |||
305 | if (($scheme == 'http' && $port != '80') | 312 | if (($scheme == 'http' && $port != '80') |
306 | || ($scheme == 'https' && $port != '443') | 313 | || ($scheme == 'https' && $port != '443') |
307 | ) { | 314 | ) { |