mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Added the support for an env variable HEROKU, which causes, that Symfony trusts all proxies.
This commit is contained in:
parent
d17c4a2b6f
commit
c075d6a6a5
1 changed files with 7 additions and 0 deletions
|
@ -20,8 +20,15 @@ if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false
|
||||||
Request::setTrustedHosts([$trustedHosts]);
|
Request::setTrustedHosts([$trustedHosts]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
|
|
||||||
|
//Set the proxy settings for heroku
|
||||||
|
if ($_SERVER['HEROKU'] ?? $_ENV['HEROKU'] ?? false) {
|
||||||
|
Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
||||||
|
}
|
||||||
|
|
||||||
$response = $kernel->handle($request);
|
$response = $kernel->handle($request);
|
||||||
$response->send();
|
$response->send();
|
||||||
$kernel->terminate($request, $response);
|
$kernel->terminate($request, $response);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue