Respect X-Forwarded-Proto header in UrlManager (closes #54)

This commit is contained in:
Bernd Bestel
2018-09-21 12:49:01 +02:00
parent 905fc0f357
commit 27daf384da

View File

@@ -32,6 +32,11 @@ class UrlManager
private function GetBaseUrl()
{
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
{
$_SERVER['HTTPS'] = 'on';
}
return (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
}
}