From 5f50a97549f48344eeed2c560d7c9d3eed48d559 Mon Sep 17 00:00:00 2001 From: lichao <2483469113@qq.com> Date: Wed, 25 Feb 2026 11:53:44 +0000 Subject: [PATCH] fix: configure CORS for Vercel frontend domain --- src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index f3218c1..0a2b886 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,7 +46,11 @@ async function bootstrap() { const configService = app.get(ConfigService); // 获取 ConfigService 实例 app.enableCors({ - origin: true, // 允许所有来源 + origin: [ + 'https://tradingadvfrontend.vercel.app', + 'http://localhost:8000', + 'http://localhost:3030', + ], // 明确指定允许的前端域名 credentials: true, // 允许携带凭证 methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'], // 明确指定允许的 HTTP 方法 allowedHeaders: [