From 5d18e60d5d772466c931e4e73377f0493e104211 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 30 Mar 2024 10:59:45 +0100 Subject: [PATCH] fix: set replace_ip default to false (#288) --- config/laravelcloudflare.php | 2 +- tests/Unit/Http/Middleware/TrustProxiesTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/laravelcloudflare.php b/config/laravelcloudflare.php index ee9e366..e4c04c9 100644 --- a/config/laravelcloudflare.php +++ b/config/laravelcloudflare.php @@ -23,7 +23,7 @@ | */ - 'replace_ip' => (bool) env('LARAVEL_CLOUDFLARE_REPLACE_IP', true), + 'replace_ip' => (bool) env('LARAVEL_CLOUDFLARE_REPLACE_IP', false), /* |-------------------------------------------------------------------------- diff --git a/tests/Unit/Http/Middleware/TrustProxiesTest.php b/tests/Unit/Http/Middleware/TrustProxiesTest.php index 092b20f..9cab758 100644 --- a/tests/Unit/Http/Middleware/TrustProxiesTest.php +++ b/tests/Unit/Http/Middleware/TrustProxiesTest.php @@ -4,7 +4,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\Route; use Monicahq\Cloudflare\Http\Middleware\TrustProxies; use Monicahq\Cloudflare\LaravelCloudflare; use Monicahq\Cloudflare\Tests\FeatureTestCase; @@ -83,6 +82,8 @@ public function it_deactivates_middleware() /** @test */ public function it_sets_remote_addr() { + config(['laravelcloudflare.replace_ip' => true]); + $request = new Request(); $request->server->set('REMOTE_ADDR', '127.0.0.1'); $request->headers->set('Cf-Connecting-Ip', '127.0.1.1');