From 956f6c70228caf2e8ae87e590c3ff5f79507babc Mon Sep 17 00:00:00 2001 From: Franzz Date: Sat, 5 Oct 2019 23:51:40 +0200 Subject: [PATCH] Fix http scheme detection --- inc/main.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/main.php b/inc/main.php index 018283b..1d7ad74 100755 --- a/inc/main.php +++ b/inc/main.php @@ -87,7 +87,8 @@ abstract class Main extends PhpObject $this->asContext['process_page'] = basename($sProcessPage); $sServerName = array_key_exists('SERVER_NAME', $_SERVER)?$_SERVER['SERVER_NAME']:$_SERVER['PWD']; - $sAppPath = $_SERVER['REQUEST_SCHEME'].'://'.str_replace(array('http://', 'https://'), '', $sServerName.dirname($_SERVER['SCRIPT_NAME'])); + $sScheme = array_key_exists('HTTP_X_FORWARDED_PROTO', $_SERVER)?$_SERVER['HTTP_X_FORWARDED_PROTO']:$_SERVER['REQUEST_SCHEME']; + $sAppPath = $sScheme.'://'.str_replace(array('http://', 'https://'), '', $sServerName.dirname($_SERVER['SCRIPT_NAME'])); $this->asContext['serv_name'] = $sAppPath.(mb_substr($sAppPath, -1)!='/'?'/':''); $this->setMasks();