fix: 放宽 CORS origin 配置为允许所有来源以支持小程序环境

This commit is contained in:
Developer
2026-05-18 22:00:40 +08:00
parent 608ee017d4
commit 344b25a2d8
+1 -5
View File
@@ -42,11 +42,7 @@ app.use(helmet({
}, },
})); }));
app.use(cors({ app.use(cors({
origin: [ origin: true,
'https://servicewechat.com',
'https://miniapp-api-test.dxz99wyr.cn',
'https://api-miniapp.dxz99wyr.cn'
],
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'Accept', 'Origin', 'X-Requested-With'], allowedHeaders: ['Content-Type', 'Authorization', 'Accept', 'Origin', 'X-Requested-With'],
credentials: false credentials: false