public/index.php line 34

Open in your IDE?
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\ErrorHandler\Debug;
  4. use Symfony\Component\HttpFoundation\Request;
  5. require dirname(__DIR__).'/config/bootstrap.php';
  6. if ($_SERVER['APP_DEBUG']) {
  7.     umask(0000);
  8.     Debug::enable();
  9. }
  10. $trustedProxies $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false;
  11. $trustedProxies $trustedProxies explode(','$trustedProxies) : [];
  12. // APP_TRUST_PROXY is not a standard Symfony env variable.
  13. // If it is set, then we add the remote address as a trusted proxy. This is safe and appropriate
  14. // for some deployment setups, like Heroku, but not for all. Use cautiously.
  15. // See: https://symfony.com/doc/current/deployment/proxies.html
  16. // And: https://devcenter.heroku.com/articles/deploying-symfony4#trusting-the-heroku-router
  17. if($_SERVER['APP_ENV'] == 'prod' && $_SERVER['APP_TRUST_PROXY']) $trustedProxies[] = $_SERVER['REMOTE_ADDR'];
  18. if($trustedProxies) {
  19.     Request::setTrustedProxies($trustedProxiesRequest::HEADER_X_FORWARDED_AWS_ELB);
  20. }
  21. if ($trustedHosts $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
  22.     Request::setTrustedHosts([$trustedHosts]);
  23. }
  24. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  25. $request Request::createFromGlobals();
  26. $response $kernel->handle($request);
  27. $response->send();
  28. $kernel->terminate($request$response);