From 695fda7159f58d3f0f5e5907606d29ba51e4acca Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 9 Apr 2026 16:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cors.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config/cors.php b/config/cors.php index a3b4e8d..a703866 100755 --- a/config/cors.php +++ b/config/cors.php @@ -21,16 +21,20 @@ return [ 'allowed_origins' => array_filter(array_map('trim', explode(',', env( 'CORS_ALLOWED_ORIGINS', - 'https://yxbd-fangke.ali251.langye.net,http://localhost:8020,http://127.0.0.1:8020' + 'https://yxbd-fangke.ali251.langye.net,http://localhost:8020,http://127.0.0.1:8020,http://localhost:8021,http://127.0.0.1:8021' )))), - 'allowed_origins_patterns' => [], + // 允许本地开发端口灵活变更(如 8020/8021/8080 等) + 'allowed_origins_patterns' => [ + '/^http:\/\/localhost(?::\d+)?$/', + '/^http:\/\/127\.0\.0\.1(?::\d+)?$/', + ], 'allowed_headers' => ['*'], 'exposed_headers' => [], - 'max_age' => 0, + 'max_age' => 86400, 'supports_credentials' => true,