This commit is contained in:
黄心宇 2024-04-18 10:41:46 +08:00
parent a679a623a1
commit baeceb9c1e
1 changed files with 2 additions and 6 deletions

View File

@ -10,16 +10,12 @@ app.use('/build', express.static('build'));
const options = (target) => {
return {
target: target,
changeOrigin: true, // 允许在请求头中更改主机
changeOrigin: false, // 允许在请求头中更改主机
timeout: 30000,
// 只改head版本不需要重写ua
// headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0'
// }
};
}
const proxy = createProxyMiddleware(options('http://127.0.0.1:8081'));
const proxy = createProxyMiddleware(options('http://localhost:8081'));
// 设置代理