From 2e037205ffae545b324c4cbcdac1c986db1ba6e5 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 23 Sep 2022 14:09:05 +0200 Subject: [PATCH] issue #982 detect HTTPS based on forwarded protocol --- include/functions_url.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 6e683fcfb..c609b45cc 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -33,6 +33,13 @@ function get_root_url() function get_absolute_root_url($with_scheme=true) { // TODO - add HERE the possibility to call PWG functions from external scripts + + // Support X-Forwarded-Proto header for HTTPS detection in PHP + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO']) + { + $_SERVER['HTTPS'] = 'on'; + } + $url = ''; if ($with_scheme) {