From 056e5c053a1b1ab34c7affd4e221612fb8ef538e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 13 Nov 2019 18:28:33 +0100 Subject: [PATCH] use hostname from setup, only if webserver-url starts with a slash, closer to previous behavior --- api/src/Header/Http.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/src/Header/Http.php b/api/src/Header/Http.php index 72a14bc55d..f561b57560 100644 --- a/api/src/Header/Http.php +++ b/api/src/Header/Http.php @@ -25,11 +25,13 @@ class Http * 2. $_SERVER['HTTP_X_FORWARDED_HOST'] (X-Forwarded-Host HTTP header) * 3. $_SERVER['HTTP_HOST'] (Host HTTP header) * + * @param boolean $use_setup_hostname =false true: hostame config from setup has highest precedence, default not * @return string */ - static function host() + static function host($use_setup_hostname=false) { - if (!empty($GLOBALS['egw_info']['server']['hostname']) && $GLOBALS['egw_info']['server']['hostname'] !== 'localhost') + if ($use_setup_hostname && !empty($GLOBALS['egw_info']['server']['hostname']) && + $GLOBALS['egw_info']['server']['hostname'] !== 'localhost') { $host = $GLOBALS['egw_info']['server']['hostname']; } @@ -75,7 +77,7 @@ class Http { if ($link[0] === '/') { - $link = self::schema().'://'.self::host().$link; + $link = self::schema().'://'.self::host(true).$link; } return $link; }