feat/websocket-remote-connection-fix #31

Merged
moyin merged 9 commits from feat/websocket-remote-connection-fix into main 2026-01-05 11:23:52 +08:00
Showing only changes of commit 6002f53cbc - Show all commits

View File

@@ -40,10 +40,17 @@ async function bootstrap() {
logger: ['error', 'warn', 'log'],
});
// 允许前端后台如Vite/React跨域访问
// 允许前端后台如Vite/React跨域访问包括WebSocket
app.enableCors({
origin: true,
origin: [
'http://localhost:3000',
'http://localhost:5173', // Vite默认端口
'https://whaletownend.xinghangee.icu',
/^https:\/\/.*\.xinghangee\.icu$/
],
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
});
// 全局启用校验管道(核心配置)