public/index.php line 36

Open in your IDE?
  1. <?php
  2. $http_origin is_string($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : null;
  3. $allowed = [
  4.     'http://quiz.local',
  5.     'http://localhost:5173',
  6.     'http://dev.puzzlax.co',
  7.     'https://dev.puzzlax.co',
  8.     'http://68.183.12.30',
  9.     'https://68.183.12.30',
  10.     'http://react.puzzlax.co',
  11.     'https://react.puzzlax.co',
  12.     'http://64.225.70.198',
  13.     'https://64.225.70.198',
  14.     'http://react.puzzlax.com',
  15.     'https://react.puzzlax.com',
  16.     'http://www.puzzlax.com',
  17.     'https://www.puzzlax.com',
  18.     'http://api.puzzlax.com',
  19.     'https://api.puzzlax.com',
  20.     'http://puzzlax.com',
  21.     'https://puzzlax.com',
  22. ];
  23. if (in_array($http_origin$allowed)) {
  24.     header("Access-Control-Allow-Origin: $http_origin");
  25. } else {
  26.     header('Access-Control-Allow-Origin: *');
  27. }
  28. header("Access-Control-Allow-Headers: Authorization, X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
  29. header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
  30. header("Allow: GET, POST, OPTIONS, PUT, DELETE");
  31. use App\Kernel;
  32. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  33. return function (array $context) {
  34.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  35. };