1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Http/Middleware/TrustProxies.php

56 lines
1.4 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
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2019-05-11 05:32:07 +02:00
*/
2018-10-04 19:10:43 +02:00
namespace App\Http\Middleware;
2020-10-01 01:32:27 +02:00
use Illuminate\Contracts\Config\Repository;
2022-06-21 12:03:51 +02:00
use Illuminate\Http\Middleware\TrustProxies as Middleware;
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
*/
2022-03-07 02:54:06 +01:00
// protected $headers = Request::HEADER_X_FORWARDED_ALL;
//07-03-2022 - fixes for symfony 5.2
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
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)
{
2022-06-22 13:57:45 +02:00
// parent::__construct($config);
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
}