From 95e150b65f17622f43ffa5cab78836f11fa33b31 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Feb 2026 14:15:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84Webman=20Request=E6=96=B9=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 request()->header('x-forwarded-proto') 替代 isSecure() - 支持反向代理环境 --- backend/app/controller/AuthController.php | 3 ++- backend/app/service/ApprovalService.php | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/app/controller/AuthController.php b/backend/app/controller/AuthController.php index b5cd114..6a0e088 100644 --- a/backend/app/controller/AuthController.php +++ b/backend/app/controller/AuthController.php @@ -290,7 +290,8 @@ class AuthController extends BaseController if ($feishuApp->mobile_callback_url) { $callbackUrl = $feishuApp->mobile_callback_url; } else { - $scheme = request()->isSecure() ? 'https' : 'http'; + // 检查反向代理的协议头 + $scheme = request()->header('x-forwarded-proto') ?? request()->header('x-scheme') ?? 'https'; $callbackUrl = $scheme . '://' . request()->host() . '/login/callback'; } $redirectUri = urlencode($callbackUrl); diff --git a/backend/app/service/ApprovalService.php b/backend/app/service/ApprovalService.php index ecd6a81..79b8530 100644 --- a/backend/app/service/ApprovalService.php +++ b/backend/app/service/ApprovalService.php @@ -506,8 +506,10 @@ class ApprovalService // 如果没有配置,使用当前请求构建 if (!$baseUrl) { - $scheme = request()->isSecure() ? 'https' : 'http'; - $baseUrl = $scheme . '://' . request()->host(); + // 检查反向代理的协议头 + $scheme = request()->header('x-forwarded-proto') ?? request()->header('x-scheme') ?? 'https'; + $host = request()->host(); + $baseUrl = $scheme . '://' . $host; } // 统一使用审批详情页,不再跳转到具体业务模块的详情页