aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTobias Ollmann <tobias@holzgeist.at>2015-09-16 19:23:20 +0200
committerTobias Ollmann <tobias@holzgeist.at>2015-09-16 19:24:57 +0200
commitd58534e8779dd9b4a6ac5386428ae562bc0b5fab (patch)
tree46f9f84f6625e3d5d6e802cae3f9681ac8ba6248 /include
parent9a622724fda3601cae710486f374f5e09d7abcba (diff)
Use HTTP_X_FORWARDED_HOST if available
This enables piwigo to be run e.g. in a docker container behind a proxy. If HTTP_X_FORWARDED_HOST is not set, HTTP_HOST is used as usual
Diffstat (limited to 'include')
-rw-r--r--include/functions_url.inc.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 5a471bc10..9cc6c9ec7 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -62,7 +62,14 @@ function get_absolute_root_url($with_scheme=true)
{
$url .= 'http://';
}
- $url .= $_SERVER['HTTP_HOST'];
+ if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))
+ {
+ $url .= $_SERVER['HTTP_X_FORWARDED_HOST'];
+ }
+ else
+ {
+ $url .= $_SERVER['HTTP_HOST'];
+ }
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
||($is_https && $_SERVER['SERVER_PORT'] != 443))
{