Skip to content

Commit

Permalink
Support for the X-Forwarded-Host
Browse files Browse the repository at this point in the history
  • Loading branch information
A---- committed Apr 24, 2020
1 parent 5861059 commit 1b8c3ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,9 @@ protected function createFromEnvironment(array $env)

// Build host.
$hostname = 'localhost';
if (isset($env['HTTP_HOST'])) {
if (isset($env['HTTP_X_FORWARDED_HOST'])) {
$hostname = $env['HTTP_X_FORWARDED_HOST'];
} else if (isset($env['HTTP_HOST'])) {
$hostname = $env['HTTP_HOST'];
} elseif (isset($env['SERVER_NAME'])) {
$hostname = $env['SERVER_NAME'];
Expand Down

0 comments on commit 1b8c3ac

Please sign in to comment.