fix: 修复内网访问ws路径失效

Related to #1
This commit is contained in:
Baobhan Sith
2025-05-01 15:07:46 +08:00
parent 0d481db3dc
commit c28a5a6de0
3 changed files with 14 additions and 24 deletions
+5 -2
View File
@@ -19,14 +19,17 @@ export default defineConfig({
// 可选:如果后端 API 路径没有 /api 前缀,可以在这里重写路径
// rewrite: (path) => path.replace(/^\/api/, '')
},
// --- 新增开始 ---
// 将所有 /uploads 开头的请求也代理到后端服务器
'/uploads': {
target: 'http://localhost:3001', // 后端服务器地址
changeOrigin: true, // 对于静态资源通常也建议开启
// 通常不需要重写静态资源的路径
},
'/ws': {
target: 'ws://localhost:3001', // 后端 WebSocket 服务器地址
ws: true,
changeOrigin: true,
}
// --- 新增结束 ---
}
}
})