Merge pull request #182

This commit is contained in:
symfony-flex-server[bot]
2017-12-02 16:22:24 +00:00
committed by GitHub
3 changed files with 10 additions and 3 deletions
@@ -3,7 +3,6 @@ framework:
#default_locale: en
#csrf_protection: ~
#http_method_override: true
#trusted_hosts: ~
# uncomment this entire section to enable sessions
#session:
+3 -1
View File
@@ -13,7 +13,9 @@
},
"env": {
"APP_ENV": "dev",
"APP_SECRET": "%generate(secret)%"
"APP_SECRET": "%generate(secret)%",
"#TRUSTED_PROXIES": "127.0.0.1,127.0.0.2",
"#TRUSTED_HOSTS": "localhost,example.com"
},
"gitignore": [
".env",
@@ -21,7 +21,13 @@ if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
Debug::enable();
}
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
$request = Request::createFromGlobals();