Unverified Commit 99edf17b authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(core) Fix port detection when using a proxy and https

issue #6108
Showing with 5 additions and 4 deletions
+5 -4
...@@ -46,15 +46,16 @@ class URL ...@@ -46,15 +46,16 @@ class URL
$protocol .= 's'; $protocol .= 's';
} }
$port = '80';
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$host = $_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'])) { if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
$protocol = $_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 { } else {
if (!empty($_SERVER['HTTP_HOST'])) { if (!empty($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST']; $host = $_SERVER['HTTP_HOST'];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment