web/app_dev.php line 72

Open in your IDE?
  1. <?php
  2. use Symfony\Component\HttpFoundation\Request;
  3. use Symfony\Component\Debug\Debug;
  4. // If you don't want to setup permissions the proper way, just uncomment the following PHP line
  5. // read http://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
  6. // for more information
  7. //umask(0000);
  8. // This check prevents access to debug front controllers that are deployed by accident to production servers.
  9. // Feel free to remove this, extend it, or make something more sophisticated.
  10. // if (isset($_SERVER['HTTP_CLIENT_IP'])
  11. //     || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  12. //     || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || php_sapi_name() === 'cli-server')
  13. // ) {
  14. //     header('HTTP/1.0 403 Forbidden');
  15. //     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  16. // }
  17. require __DIR__ '/../vendor/autoload.php';
  18. Debug::enable();
  19. $kernel = new AppKernel('dev'true);
  20. if (PHP_VERSION_ID 70000) {
  21.     $kernel->loadClassCache();
  22. }
  23. $request Request::createFromGlobals();
  24. /*
  25.  * Enable one of trusted proxy configurations below
  26.  *
  27.  * This tells Symfony Router to trust `X-Forwarded-*` headers from reverse proxies in front of it (e.g. Varnish). If
  28.  * this is not configured properly for the respective environment, the Router will ignore the headers and e.g. generate
  29.  * http-only links (ignoring `X-Forwarded-Proto` header that indicates that website uses https).
  30.  *
  31.  * See:
  32.  *
  33.  * - https://symfony.com/blog/fixing-the-trusted-proxies-configuration-for-symfony-3-3
  34.  * - https://stackoverflow.com/a/50110665/282325
  35.  */
  36. $dockerIpRanges = [
  37.     '127.0.0.1',
  38.     '10.0.0.0/8',
  39.     '172.16.0.0/12',
  40.     '192.168.0.0/16',
  41. ];
  42. $zutomIpRanges = [
  43.     '127.0.0.1',
  44. ];
  45. $cloudflareIpRanges = [
  46.     // https://www.cloudflare.com/ips/
  47.     '103.21.244.0/22',
  48.     '103.22.200.0/22',
  49.     '103.31.4.0/22',
  50.     '104.16.0.0/12',
  51.     '108.162.192.0/18',
  52.     '131.0.72.0/22',
  53.     '141.101.64.0/18',
  54.     '162.158.0.0/15',
  55.     '172.64.0.0/13',
  56.     '173.245.48.0/20',
  57.     '188.114.96.0/20',
  58.     '190.93.240.0/20',
  59.     '197.234.240.0/22',
  60.     '198.41.128.0/17',
  61. ];
  62. // Request::setTrustedProxies(array_merge($dockerIpRanges), Request::HEADER_X_FORWARDED_ALL); // docker
  63. Request::setTrustedProxies(array_merge($zutomIpRanges), Request::HEADER_X_FORWARDED_ALL); // Zutom PROD not behind Cloudflare
  64. // Request::setTrustedProxies(array_merge($zutomIpRanges, $cloudflareIpRanges), Request::HEADER_X_FORWARDED_ALL); // Zutom PROD behind Cloudflare
  65. $response $kernel->handle($request);
  66. $response->send();
  67. $kernel->terminate($request$response);