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 7e1a645
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1168,8 +1168,9 @@ protected function createFromEnvironment(array $env)
$this->password = $env['PHP_AUTH_PW'] ?? null;

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

0 comments on commit 7e1a645

Please sign in to comment.