From 736a02e6871434ed840d9bb6635a37cb360b6f5e Mon Sep 17 00:00:00 2001 From: Takuro Hishikawa Date: Mon, 18 Apr 2016 18:56:28 +0900 Subject: [PATCH] Fix the position to set trusted proxies --- web/concrete/bootstrap/start.php | 33 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/web/concrete/bootstrap/start.php b/web/concrete/bootstrap/start.php index be98bc68b71..0378692ca3a 100644 --- a/web/concrete/bootstrap/start.php +++ b/web/concrete/bootstrap/start.php @@ -134,6 +134,22 @@ // Register all other providers $list->registerProviders($config->get('app.providers')); +/** + * ---------------------------------------------------------------------------- + * Set trusted proxies and headers for the request + * ---------------------------------------------------------------------------- + */ + +if($proxyHeaders = $config->get('concrete.security.trusted_proxies.headers')){ + foreach($proxyHeaders as $key => $value) { + Request::setTrustedHeaderName($key, $value); + } +} + +if($trustedProxiesIps = $config->get('concrete.security.trusted_proxies.ips')) { + Request::setTrustedProxies($trustedProxiesIps); +} + /** * ---------------------------------------------------------------------------- * Legacy Definitions @@ -190,23 +206,6 @@ */ include DIR_APPLICATION . '/bootstrap/app.php'; - -/** - * ---------------------------------------------------------------------------- - * Set trusted proxies and headers for the request - * ---------------------------------------------------------------------------- - */ - -if($proxyHeaders = $config->get('concrete.security.trusted_proxies.headers')){ - foreach($proxyHeaders as $key => $value) { - Request::setTrustedHeaderName($key, $value); - } -} - -if($trustedProxiesIps = $config->get('concrete.security.trusted_proxies.ips')) { - Request::setTrustedProxies($trustedProxiesIps); -} - /** * ---------------------------------------------------------------------------- * Obtain the Request object.