Skip to content

Commit

Permalink
Enable trusted proxies in Symfony ^3.3 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudz authored and andig committed Jun 25, 2018
1 parent 4ee4570 commit 305b9ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Bootstraps/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public function getApplication()
$app->booted = true;
}, $app);

if ($trustedProxies = isset($_SERVER['TRUSTED_PROXIES']) ? $_SERVER['TRUSTED_PROXIES'] : false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = isset($_SERVER['TRUSTED_HOSTS']) ? $_SERVER['TRUSTED_HOSTS'] : false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}

return $app;
}

Expand Down

0 comments on commit 305b9ab

Please sign in to comment.