Set trusted proxies value from config if present. #882

This commit is contained in:
James Cole 2017-10-02 18:19:17 +02:00
parent 1bfa8f0139
commit ebcd8dbd7c
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
@ -37,4 +38,19 @@ class TrustProxies extends Middleware
* @var array
*/
protected $proxies;
/**
* TrustProxies constructor.
*
* @param Repository $config
*/
public function __construct(Repository $config)
{
$trustedProxies = env('TRUSTED_PROXIES', null);
if (!is_null($trustedProxies) && strlen($trustedProxies) > 0) {
$this->proxies = $trustedProxies;
}
parent::__construct($config);
}
}