diff --git a/include/class_URL.inc b/include/class_URL.inc index 9788c1820117d9b48403430d64f8e36a27ec8a40..0ad8c72be864bb1b0be1291078d119a6213f4c99 100644 --- a/include/class_URL.inc +++ b/include/class_URL.inc @@ -46,15 +46,16 @@ class URL $protocol .= 's'; } - $port = '80'; if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { $host = $_SERVER['HTTP_X_FORWARDED_HOST']; - if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) { - $port = $_SERVER['HTTP_X_FORWARDED_PORT']; - } if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $protocol = $_SERVER['HTTP_X_FORWARDED_PROTO']; } + if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $port = $_SERVER['HTTP_X_FORWARDED_PORT']; + } else { + $port = ($protocol === 'http' ? 80 : 443); + } } else { if (!empty($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST'];