diff --git a/symfony/framework-bundle/3.3/config/packages/framework.yaml b/symfony/framework-bundle/3.3/config/packages/framework.yaml index bc68ab73..b32f52d9 100644 --- a/symfony/framework-bundle/3.3/config/packages/framework.yaml +++ b/symfony/framework-bundle/3.3/config/packages/framework.yaml @@ -3,7 +3,6 @@ framework: #default_locale: en #csrf_protection: ~ #http_method_override: true - #trusted_hosts: ~ # uncomment this entire section to enable sessions #session: diff --git a/symfony/framework-bundle/3.3/manifest.json b/symfony/framework-bundle/3.3/manifest.json index cada9b41..1f02a829 100644 --- a/symfony/framework-bundle/3.3/manifest.json +++ b/symfony/framework-bundle/3.3/manifest.json @@ -13,7 +13,9 @@ }, "env": { "APP_ENV": "dev", - "APP_SECRET": "%generate(secret)%" + "APP_SECRET": "%generate(secret)%", + "#APP_TRUSTED_PROXIES": "127.0.0.1,127.0.0.2", + "#APP_TRUSTED_HOSTS": "localhost,example.com" }, "gitignore": [ ".env", diff --git a/symfony/framework-bundle/3.3/public/index.php b/symfony/framework-bundle/3.3/public/index.php index 3c7ed08f..ad54fa17 100644 --- a/symfony/framework-bundle/3.3/public/index.php +++ b/symfony/framework-bundle/3.3/public/index.php @@ -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['APP_TRUSTED_PROXIES'] ?? false) { + Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); +} + +if ($trustedHosts = $_SERVER['APP_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();