From a7b7d8da4ac5a77e5b2a5161a153f31cb8a8bec2 Mon Sep 17 00:00:00 2001 From: z Date: Wed, 30 Sep 2020 13:36:00 +0800 Subject: [PATCH] * fix bug for set https. --- module/common/model.php | 2 +- module/doc/view/view.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index ec1cba610f..5e98eff0cd 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1687,7 +1687,7 @@ EOD; public static function getSysURL() { $httpType = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http'; - if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strpos($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https'; + if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https'; $httpHost = $_SERVER['HTTP_HOST']; return "$httpType://$httpHost"; } diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index c5a1c2e913..a89b3ab1f4 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -85,7 +85,7 @@ js::set('docID', $doc->id); $url = $doc->content; if(!preg_match('/^https?:\/\//', $doc->content)) $url = 'http://' . $url; $urlIsHttps = strpos($url, 'https://') === 0; - $serverIsHttps = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strpos($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')); + $serverIsHttps = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')); if(($urlIsHttps and $serverIsHttps) or (!$urlIsHttps and !$serverIsHttps)) { echo "";