Skip to content

Commit

Permalink
Respect X-Forwarded-Proto header in UrlManager (closes #54)
Browse files Browse the repository at this point in the history
  • Loading branch information
berrnd committed Sep 21, 2018
1 parent 905fc0f commit 27daf38
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions helpers/UrlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function ConstructUrl($relativePath, $isResource = false)

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]";
}
}

0 comments on commit 27daf38

Please sign in to comment.