12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- declare(strict_types = 1);
- use App\CacheKernel;
- use App\Kernel;
- use App\Core\Security;
- use Symfony\Component\ErrorHandler\Debug;
- use Symfony\Component\HttpFoundation\Request;
- require \dirname(__DIR__) . '/config/bootstrap.php';
- if ($_SERVER['APP_DEBUG']) {
- umask(0000);
- Debug::enable();
- }
- if ($trustedProxies = $_ENV['TRUSTED_PROXIES'] ?? $_SERVER['TRUSTED_PROXIES'] ?? false) {
- Request::setTrustedProxies(
- explode(',', $trustedProxies),
- Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO,
- );
- }
- if ($trustedHosts = $_ENV['TRUSTED_HOSTS'] ?? $_SERVER['TRUSTED_HOSTS'] ?? false) {
- Request::setTrustedHosts([$trustedHosts]);
- }
- $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
- if ('prod' === $kernel->getEnvironment() || isset($_ENV['CONFIG_USE_CACHE_KERNEL'])) {
- $kernel = new CacheKernel($kernel);
- }
- $request = Request::createFromGlobals();
- Security::harden();
- $response = $kernel->handle($request);
- $response->send();
- $kernel->terminate($request, $response);
|