修复工作

This commit is contained in:
2025-10-01 23:27:08 +08:00
parent e462a99645
commit 182f045517
2 changed files with 34 additions and 10 deletions

View File

@@ -31,9 +31,26 @@ export default defineConfig(({ mode, command }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://localhost:8080',
target: 'http://localhost:10081',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
},
// 视频流代理HTTP-FLV
'/live': {
target: 'http://localhost:10083/live',
changeOrigin: true,
// 关键:禁用所有缓冲,实时转发
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('🎬 代理视频流请求:', req.url);
});
proxy.on('proxyRes', (proxyRes, req, res) => {
console.log('📺 收到视频流响应,开始转发...');
// 禁用缓冲
proxyRes.headers['x-accel-buffering'] = 'no';
proxyRes.headers['cache-control'] = 'no-cache';
});
}
}
}
},