good version for 算法注册
This commit is contained in:
@@ -14,8 +14,24 @@ export default defineConfig({
|
||||
'/api': {
|
||||
target: 'http://localhost:8001',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '/api/v1'),
|
||||
timeout: 600000 // 10分钟超时
|
||||
rewrite: (path) => {
|
||||
// 如果路径已经是 /api/v1/ 开头,则不重写
|
||||
if (path.startsWith('/api/v1/')) {
|
||||
return path
|
||||
}
|
||||
// 否则将 /api/ 重写为 /api/v1/
|
||||
return path.replace(/^\/api\//, '/api/v1/')
|
||||
},
|
||||
timeout: 600000, // 10分钟超时
|
||||
// 确保认证头在重定向时被保留
|
||||
configure: (proxy, options) => {
|
||||
proxy.on('proxyReq', (proxyReq, req, res) => {
|
||||
// 确保认证头被正确传递
|
||||
if (req.headers.authorization) {
|
||||
proxyReq.setHeader('Authorization', req.headers.authorization)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user