From 2a6e021191a6c7edaa0f09334404cced3b490062 Mon Sep 17 00:00:00 2001 From: z Date: Thu, 24 Sep 2020 13:24:14 +0800 Subject: [PATCH] * finish task #7986. --- module/common/model.php | 1 + module/doc/view/view.html.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/common/model.php b/module/common/model.php index 16bd17b461..b48f217605 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1672,6 +1672,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'; $httpHost = $_SERVER['HTTP_HOST']; return "$httpType://$httpHost"; } diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index bd2e60a086..c5a1c2e913 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'; + $serverIsHttps = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strpos($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')); if(($urlIsHttps and $serverIsHttps) or (!$urlIsHttps and !$serverIsHttps)) { echo "";