From 0cd891fdc7e71032cac6cf5040793d5f6de1f6f2 Mon Sep 17 00:00:00 2001 From: Henri Knochenhauer Date: Mon, 17 Nov 2014 17:25:40 +0100 Subject: [PATCH 1/2] add HTTP_X_FORWARDED_PROTO add possibility to get configured https via header-param https://github.com/AKSW/OntoWiki/wiki/OntoWiki-behind-a-reverseProxy-(with-SSL) --- application/Bootstrap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 9b811b965..0da361e18 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -164,6 +164,7 @@ public function _initConfig() // set path variables $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE)); $protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; + $protocol = ($protocol == 'http' && isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ? 'https' : 'http' ; if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80' From 8ce07cbeccdb61f64857b56f038480aaf2669f33 Mon Sep 17 00:00:00 2001 From: Henri Knochenhauer Date: Tue, 18 Nov 2014 09:45:51 +0100 Subject: [PATCH 2/2] refactoring of added line --- application/Bootstrap.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 0da361e18..2c514a548 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -164,7 +164,9 @@ public function _initConfig() // set path variables $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE)); $protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; - $protocol = ($protocol == 'http' && isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ? 'https' : 'http' ; + $protocol = ($protocol == 'http' && + isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ? 'https' : 'http' ; if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80'