From 015ea3c655ff871f492e80b10b928cf1065e4512 Mon Sep 17 00:00:00 2001 From: Pedro Cunha Date: Fri, 29 Nov 2024 00:38:55 +0000 Subject: [PATCH] feat: move trusted proxies to a config file --- bootstrap/app.php | 7 ++++--- config/trustedproxies.php | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 config/trustedproxies.php diff --git a/bootstrap/app.php b/bootstrap/app.php index c4fd8aff..f81b99fb 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -30,9 +30,10 @@ 'solder_users' => \App\Http\Middleware\SolderUsers::class, ]); - $middleware->trustProxies(at: [ - '10.0.0.0/8', - ], headers: Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PROTO); + $middleware->trustProxies( + at: config('trustedproxies', []), + headers: Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PROTO + ); }) ->withExceptions(function (Exceptions $exceptions) { // diff --git a/config/trustedproxies.php b/config/trustedproxies.php new file mode 100644 index 00000000..bc289f00 --- /dev/null +++ b/config/trustedproxies.php @@ -0,0 +1,5 @@ +