aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorFanch <fanch-github@qth.fr>2015-09-01 13:37:04 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-09-13 21:17:01 +0200
commit7b114771d337af3bfd51d8fda1e8f2fd5b39535d (patch)
tree897fa51315d233af261dd7a13c011f46ff7b4816 /index.php
parentce47a75864d7d398a68705df67da2ae00ca89eca (diff)
downloadShaarli-7b114771d337af3bfd51d8fda1e8f2fd5b39535d.tar.gz
Shaarli-7b114771d337af3bfd51d8fda1e8f2fd5b39535d.tar.zst
Shaarli-7b114771d337af3bfd51d8fda1e8f2fd5b39535d.zip
SSL detection: add support for `X-Forwarded-Proto`
Duplicates #332 See: - RFC 7239 - Forwarded HTTP Extension http://www.ietf.org/rfc/rfc7239.txt - RFC 6238 - Deprecating the "X-" Prefix and Similar Constructs in Application Protocols http://www.ietf.org/rfc/rfc6648.txt - StackOverflow - Custom HTTP headers: naming conventions http://stackoverflow.com/a/3561399
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/index.php b/index.php
index 61d92f04..7818ee88 100755
--- a/index.php
+++ b/index.php
@@ -463,7 +463,7 @@ if (isset($_POST['login']))
463// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL. 463// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.
464function serverUrl() 464function serverUrl()
465{ 465{
466 $https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443'; // HTTPS detection. 466 $https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443' || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'); // HTTPS detection.
467 $serverport = ($_SERVER["SERVER_PORT"]=='80' || ($https && $_SERVER["SERVER_PORT"]=='443') ? '' : ':'.$_SERVER["SERVER_PORT"]); 467 $serverport = ($_SERVER["SERVER_PORT"]=='80' || ($https && $_SERVER["SERVER_PORT"]=='443') ? '' : ':'.$_SERVER["SERVER_PORT"]);
468 return 'http'.($https?'s':'').'://'.$_SERVER['SERVER_NAME'].$serverport; 468 return 'http'.($https?'s':'').'://'.$_SERVER['SERVER_NAME'].$serverport;
469} 469}