diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-09-26 11:11:44 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-09-26 11:11:44 +0200 |
commit | c3c7c422c0b6c95bd04bfa0a0db74a3fcac73edb (patch) | |
tree | 7b6556b24d93ea304bad256a2f9ae7be0d933e84 /inc | |
parent | cdb157d1be96e399fcf2f1ed4917457e1ec94c74 (diff) | |
parent | c42f789c87b115a747a7436d81e7aee886d0ac88 (diff) | |
download | rpg-c3c7c422c0b6c95bd04bfa0a0db74a3fcac73edb.tar.gz rpg-c3c7c422c0b6c95bd04bfa0a0db74a3fcac73edb.tar.bz2 |
Merge pull request #799 from enricotagliavini/master
Adding X-Forwarded-Proto support
Diffstat (limited to 'inc')
-rw-r--r-- | inc/init.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/inc/init.php b/inc/init.php index 4ff239787..d825b5250 100644 --- a/inc/init.php +++ b/inc/init.php @@ -456,10 +456,6 @@ function getBaseURL($abs=null){ $port = ''; } - if(!$port && isset($_SERVER['SERVER_PORT'])) { - $port = $_SERVER['SERVER_PORT']; - } - if(is_null($port)){ $port = ''; } @@ -490,6 +486,14 @@ function getBaseURL($abs=null){ * @returns bool true when SSL is active */ function is_ssl(){ + // check if we are behind a reverse proxy + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + return true; + } else { + return false; + } + } if (!isset($_SERVER['HTTPS']) || preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){ return false; |