From 555eb9faf430bb64d054b17d8a1fd74d708a9583 Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Sun, 12 Oct 2025 17:57:09 +0300 Subject: [PATCH] Refactor: Extract Forge/Vapor domain check into variable --- 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 e7e526374fae..c19b5d41d4cb 100644 --- a/src/Illuminate/Http/Middleware/TrustProxies.php +++ b/src/Illuminate/Http/Middleware/TrustProxies.php @@ -68,15 +68,14 @@ protected function setTrustedProxyIpAddresses(Request $request) { $trustedIps = $this->proxies() ?: config('trustedproxy.proxies'); - if (is_null($trustedIps) && - (laravel_cloud() || - str_ends_with($request->host(), '.on-forge.com') || - str_ends_with($request->host(), '.on-vapor.com'))) { + $isForgeOrVapor = str_ends_with($request->host(), '.on-forge.com') || + str_ends_with($request->host(), '.on-vapor.com'); + + if (is_null($trustedIps) && (laravel_cloud() || $isForgeOrVapor)) { $trustedIps = '*'; } - if (str_ends_with($request->host(), '.on-forge.com') || - str_ends_with($request->host(), '.on-vapor.com')) { + if ($isForgeOrVapor) { $request->headers->remove('X-Forwarded-Host'); }