public/index.php line 33

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['HTTP_HOST'] != 'localhost' and $_SERVER['HTTP_X_FORWARDED_PROTO'] != "https") {
  7.     $location = 'https://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  8.     $location = str_replace("www.www","www", $location);
  9.     header('HTTP/1.1 301 Moved Permanently');
  10.     header('Location: ' . $location);
  11.     exit;
  12. }
  13. if ($_SERVER['APP_DEBUG']) {
  14.     umask(0000);
  15.     Debug::enable();
  16. }
  17. if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
  18.     Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
  19. }
  20. if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
  21.     Request::setTrustedHosts([$trustedHosts]);
  22. }
  23. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  24. $request = Request::createFromGlobals();
  25. $response = $kernel->handle($request);
  26. $response->send();
  27. $kernel->terminate($request, $response);