fix: configure CORS for Vercel frontend domain
This commit is contained in:
parent
ec17b894a6
commit
5f50a97549
|
|
@ -46,7 +46,11 @@ async function bootstrap() {
|
||||||
const configService = app.get(ConfigService); // 获取 ConfigService 实例
|
const configService = app.get(ConfigService); // 获取 ConfigService 实例
|
||||||
|
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: true, // 允许所有来源
|
origin: [
|
||||||
|
'https://tradingadvfrontend.vercel.app',
|
||||||
|
'http://localhost:8000',
|
||||||
|
'http://localhost:3030',
|
||||||
|
], // 明确指定允许的前端域名
|
||||||
credentials: true, // 允许携带凭证
|
credentials: true, // 允许携带凭证
|
||||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'], // 明确指定允许的 HTTP 方法
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'], // 明确指定允许的 HTTP 方法
|
||||||
allowedHeaders: [
|
allowedHeaders: [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue