1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/Middleware/TrustProxies.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2018-10-04 19:10:43 +02:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
* @license https://opensource.org/licenses/AAL
*/
2018-10-04 19:10:43 +02:00
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
2020-10-01 01:32:27 +02:00
use Illuminate\Contracts\Config\Repository;
2020-11-25 15:19:52 +01:00
use Illuminate\Http\Request;
2018-10-04 19:10:43 +02:00
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
2020-10-01 01:32:27 +02:00
/*
* Instantiate trusted proxies middleware
*
* @param \Illuminate\Contracts\Config\Repository $config
*/
2020-11-25 15:19:52 +01:00
public function __construct(Repository $config)
{
parent::__construct($config);
2020-10-01 01:32:27 +02:00
2020-11-25 15:19:52 +01:00
if (config('ninja.trusted_proxies')) {
$this->proxies = config('ninja.trusted_proxies');
}
2020-10-01 01:32:27 +02:00
}
2018-10-04 19:10:43 +02:00
}