mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-08 06:14:54 +02:00
Merge pull request #353 from holzgeist/develop
Use HTTP_X_FORWARDED_HOST if available
This commit is contained in:
@@ -62,14 +62,21 @@ function get_absolute_root_url($with_scheme=true)
|
||||
{
|
||||
$url .= 'http://';
|
||||
}
|
||||
$url .= $_SERVER['HTTP_HOST'];
|
||||
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
|
||||
||($is_https && $_SERVER['SERVER_PORT'] != 443))
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))
|
||||
{
|
||||
$url_port = ':'.$_SERVER['SERVER_PORT'];
|
||||
if (strrchr($url, ':') != $url_port)
|
||||
$url .= $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$url .= $_SERVER['HTTP_HOST'];
|
||||
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
|
||||
||($is_https && $_SERVER['SERVER_PORT'] != 443))
|
||||
{
|
||||
$url .= $url_port;
|
||||
$url_port = ':'.$_SERVER['SERVER_PORT'];
|
||||
if (strrchr($url, ':') != $url_port)
|
||||
{
|
||||
$url .= $url_port;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user