-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (33 loc) · 1.22 KB
/
index.php
File metadata and controls
40 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use Outlandish\Wpackagist\Kernel;
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 = $_SERVER['TRUSTED_PROXIES'] ?? false) {
// Trust X-Forwarded-For, Proto, and Port headers (but not Host for security)
Request::setTrustedProxies(
explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PORT
);
} else {
/**
* If no env override, get the correct request context behind an AWS load balancer.
* @link https://symfony.com/doc/5.2/deployment/proxies.html
*/
Request::setTrustedProxies(
['127.0.0.1', 'REMOTE_ADDR'], // REMOTE_ADDR string replaced at runtime.
Request::HEADER_X_FORWARDED_AWS_ELB
);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);