From 1598edf8ee63500f077ac7a8bd5569525a15d083 Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Sat, 11 Oct 2025 18:22:08 +0300 Subject: [PATCH 1/2] Micro performance improvement --- src/Illuminate/Http/Middleware/TrustProxies.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Http/Middleware/TrustProxies.php b/src/Illuminate/Http/Middleware/TrustProxies.php index e7e526374fae..d5a3f4e6b800 100644 --- a/src/Illuminate/Http/Middleware/TrustProxies.php +++ b/src/Illuminate/Http/Middleware/TrustProxies.php @@ -68,15 +68,17 @@ protected function setTrustedProxyIpAddresses(Request $request) { $trustedIps = $this->proxies() ?: config('trustedproxy.proxies'); + $host = $request->host(); + if (is_null($trustedIps) && (laravel_cloud() || - str_ends_with($request->host(), '.on-forge.com') || - str_ends_with($request->host(), '.on-vapor.com'))) { + str_ends_with($host, '.on-forge.com') || + str_ends_with($host, '.on-vapor.com'))) { $trustedIps = '*'; } - if (str_ends_with($request->host(), '.on-forge.com') || - str_ends_with($request->host(), '.on-vapor.com')) { + if (str_ends_with($host, '.on-forge.com') || + str_ends_with($host, '.on-vapor.com')) { $request->headers->remove('X-Forwarded-Host'); } From de9285dfaeb606067d794d134b564dc91ef8190d Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Sun, 12 Oct 2025 11:10:28 +0300 Subject: [PATCH 2/2] wip --- src/Illuminate/Http/Middleware/TrustProxies.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Http/Middleware/TrustProxies.php b/src/Illuminate/Http/Middleware/TrustProxies.php index d5a3f4e6b800..7f7e9766b5f7 100644 --- a/src/Illuminate/Http/Middleware/TrustProxies.php +++ b/src/Illuminate/Http/Middleware/TrustProxies.php @@ -70,15 +70,14 @@ protected function setTrustedProxyIpAddresses(Request $request) $host = $request->host(); - if (is_null($trustedIps) && - (laravel_cloud() || - str_ends_with($host, '.on-forge.com') || - str_ends_with($host, '.on-vapor.com'))) { + $isForgeOrVapor = str_ends_with($host, '.on-forge.com') || + str_ends_with($host, '.on-vapor.com'); + + if (is_null($trustedIps) && (laravel_cloud() || $isForgeOrVapor)) { $trustedIps = '*'; } - if (str_ends_with($host, '.on-forge.com') || - str_ends_with($host, '.on-vapor.com')) { + if ($isForgeOrVapor) { $request->headers->remove('X-Forwarded-Host'); }