From 4412cd7162a5f4a1c64726507df4ab3a3c1fa774 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 22 Aug 2023 16:53:31 -0400 Subject: [PATCH] Set the IP when null to fix usage with trusted proxies (#146) Co-authored-by: Jonas Siewertsen Co-authored-by: jasonvarga --- src/Commands/StaticSiteServe.php | 1 + src/Route.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/Commands/StaticSiteServe.php b/src/Commands/StaticSiteServe.php index 0e0dda4..5f1b4c1 100644 --- a/src/Commands/StaticSiteServe.php +++ b/src/Commands/StaticSiteServe.php @@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; + use function Termwind\terminal; class StaticSiteServe extends Command diff --git a/src/Route.php b/src/Route.php index 4e90f64..dc8da7f 100644 --- a/src/Route.php +++ b/src/Route.php @@ -32,6 +32,10 @@ public function site() public function toResponse($request) { + if (is_null($request->ip())) { + $request->server->add(['REMOTE_ADDR' => '0.0.0.0']); + } + $kernel = app(Kernel::class); $response = $kernel->handle($request); $kernel->terminate($request, $response);