2019-02-23 16:49:38 +01:00
|
|
|
<?php
|
2019-11-01 13:40:30 +01:00
|
|
|
/**
|
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
2019-02-23 16:49:38 +01:00
|
|
|
|
|
|
|
use App\Kernel;
|
2020-01-07 19:06:08 +01:00
|
|
|
use Symfony\Component\ErrorHandler\Debug;
|
2019-02-23 16:49:38 +01:00
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
|
|
|
require dirname(__DIR__).'/config/bootstrap.php';
|
|
|
|
|
|
|
|
if ($_SERVER['APP_DEBUG']) {
|
|
|
|
umask(0000);
|
|
|
|
|
|
|
|
Debug::enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
|
|
|
|
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
|
|
|
|
Request::setTrustedHosts([$trustedHosts]);
|
|
|
|
}
|
|
|
|
|
2019-04-05 23:54:10 +02:00
|
|
|
|
2019-02-23 16:49:38 +01:00
|
|
|
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
|
|
|
$request = Request::createFromGlobals();
|
2019-04-05 23:54:10 +02:00
|
|
|
|
|
|
|
//Set the proxy settings for heroku
|
|
|
|
if ($_SERVER['HEROKU'] ?? $_ENV['HEROKU'] ?? false) {
|
|
|
|
Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
|
|
|
}
|
|
|
|
|
2019-02-23 16:49:38 +01:00
|
|
|
$response = $kernel->handle($request);
|
|
|
|
$response->send();
|
|
|
|
$kernel->terminate($request, $response);
|