From 468a984d37b05ae3da83c9a468df145e82a3d679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 26 Oct 2021 16:23:06 +0200 Subject: [PATCH 1/2] Customers index fix reset sort columns --- resources/views/customer/index-tableHeaders.blade.php | 2 +- resources/views/customer/index.blade.php | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/resources/views/customer/index-tableHeaders.blade.php b/resources/views/customer/index-tableHeaders.blade.php index 326bdbf..0db1b1c 100644 --- a/resources/views/customer/index-tableHeaders.blade.php +++ b/resources/views/customer/index-tableHeaders.blade.php @@ -71,6 +71,6 @@ @if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col")) - ⌫ + ⌫ @endif diff --git a/resources/views/customer/index.blade.php b/resources/views/customer/index.blade.php index 1cc32f9..72b2fa6 100644 --- a/resources/views/customer/index.blade.php +++ b/resources/views/customer/index.blade.php @@ -43,11 +43,6 @@ @include('customer.index-tableHeaders') - - @if(session("crud.$modelTable.sort_way") and session("crud.$modelTable.sort_col")) - ⌫ - @endif - From 8938dc42013d8c58ac736bc9ec75aac3112cda4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 26 Oct 2021 16:56:45 +0200 Subject: [PATCH 2/2] Add Trust proxies for HA proxy funcking fix --- app/Http/Middleware/TrustProxies.php | 6 +++- config/trustedproxy.php | 53 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 config/trustedproxy.php diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 919aec9..118a36b 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -20,5 +20,9 @@ class TrustProxies extends Middleware * * @var int */ - protected $headers = Request::HEADER_X_FORWARDED_ALL; + 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; } diff --git a/config/trustedproxy.php b/config/trustedproxy.php new file mode 100644 index 0000000..376df3b --- /dev/null +++ b/config/trustedproxy.php @@ -0,0 +1,53 @@ + [ + '192.168.31.9', // HA PROXY prod "Virtual IP" + '192.168.31.10', // HA PROXY prod "Virtual IP" redondance + '192.168.34.15' // HA PROXY dev "Virtual IP" + ], + + /* + * To trust one or more specific proxies that connect + * directly to your server, use an array or a string separated by comma of IP addresses: + */ + + /* + * Or, to trust all proxies that connect + * directly to your server, use a "*" + */ + + /* + * Which headers to use to detect proxy related data (For, Host, Proto, Port) + * + * Options include: + * + * - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust) + * - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust) + * - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer) + * + * - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust) + * - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust) + * - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer) + * + * @link https://symfony.com/doc/current/deployment/proxies.html + */ + 'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_FOR | + Illuminate\Http\Request::HEADER_X_FORWARDED_HOST | + Illuminate\Http\Request::HEADER_X_FORWARDED_PORT | + Illuminate\Http\Request::HEADER_X_FORWARDED_PROTO, +];