From 95a1763d04db7ad594d7b3e411679b338a707497 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Thu, 29 Jan 2026 10:04:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(framework):=20=E4=BF=AE=E6=AD=A3=20TrustPro?= =?UTF-8?q?xies=20=E9=85=8D=E7=BD=AE=E4=BB=A5=E8=A7=A3=E6=B1=BA=20HTTPS=20?= =?UTF-8?q?=E8=AD=98=E5=88=A5=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootstrap/app.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bootstrap/app.php b/bootstrap/app.php index 3721148..a0c4ca7 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -8,8 +8,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException; use Spatie\Permission\Exceptions\UnauthorizedException; use Inertia\Inertia; -// 信任所有代理(用於反向代理環境) -TrustProxies::at('*'); return Application::configure(basePath: dirname(__DIR__)) ->withRouting( @@ -18,6 +16,9 @@ return Application::configure(basePath: dirname(__DIR__)) health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { + // 信任所有代理(用於反向代理環境) + $middleware->trustProxies(at: '*'); + // Tenancy 必須最先執行,確保資料庫連線在 Session 讀取之前建立 $middleware->web(prepend: [ \App\Http\Middleware\UniversalTenancy::class,