mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-05 17:32:25 +02:00
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
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user