From a3bbeb541eac73131a6f7fb19fb330e3c32f8a20 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 23 Jun 2019 08:29:24 +0100 Subject: [PATCH] Fix use of env. Closes #3651 --- app/Http/Middleware/TrustProxies.php | 5 ++++- config/trustedproxy.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 9fcdfb79..83a86c5e 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -13,6 +13,7 @@ namespace CachetHQ\Cachet\Http\Middleware; use Fideloper\Proxy\TrustProxies as Middleware; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Config; /** * This is the trust proxies middleware class. @@ -42,6 +43,8 @@ class TrustProxies extends Middleware */ public function __construct() { - $this->proxies = empty(env('TRUSTED_PROXIES')) ? '*' : explode(',', trim(env('TRUSTED_PROXIES'))); + $proxies = Config::get('trustedproxies.proxies'); + + $this->proxies = empty($proxies) ? '*' : explode(',', trim($proxies)); } } diff --git a/config/trustedproxy.php b/config/trustedproxy.php index c8cfc7c0..b815629b 100644 --- a/config/trustedproxy.php +++ b/config/trustedproxy.php @@ -24,7 +24,7 @@ return [ * of your proxy (e.g. if using ELB or similar). * */ - 'proxies' => null, // [,], '*' + 'proxies' => env('TRUSTED_PROXIES'), // [,], '*' /* * To trust one or more specific proxies that connect