fix: dev 代理全部路径统一静默处理服务启动窗口期的连接错误

- /uploads、/t、/trace 代理补 onProxyError,目标未就绪时返回 503 由前端重试
This commit is contained in:
Nixevol
2026-07-10 10:17:11 +08:00
parent 6e0db6eeb9
commit e79415e6d5
+3 -3
View File
@@ -59,9 +59,9 @@ export default defineConfig({
// 生产由 API 单端口托管全部路径,短链 {BASE_URL}/t/xxx 天然可用;此处让本地行为对齐。
proxy: {
'/api': { target: 'http://localhost:3000', changeOrigin: true, configure: onProxyError },
'/uploads': { target: 'http://localhost:3000', changeOrigin: true },
'^/t/.*': { target: 'http://localhost:3000', changeOrigin: true },
'/trace': { target: 'http://localhost:5174', changeOrigin: true, ws: true },
'/uploads': { target: 'http://localhost:3000', changeOrigin: true, configure: onProxyError },
'^/t/.*': { target: 'http://localhost:3000', changeOrigin: true, configure: onProxyError },
'/trace': { target: 'http://localhost:5174', changeOrigin: true, ws: true, configure: onProxyError },
},
},
build: {