feat: 优化开发配置
This commit is contained in:
@@ -33,13 +33,32 @@ export default defineConfig(({ command, mode }) => {
|
||||
[env.VITE_APP_BASEAPI]: {
|
||||
target: env.VITE_APP_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api-dev/, ""),
|
||||
rewrite: (path) => path.replace(`${[env.VITE_APP_BASEAPI]}`, ""),
|
||||
|
||||
//查看真实代理url
|
||||
// bypass(req, res, options) {
|
||||
|
||||
// const proxyUrl = options.target + options.rewrite(req.url);
|
||||
// console.log(proxyUrl);
|
||||
// req.headers['X-req-proxyURL'] = proxyUrl;
|
||||
// res.setHeader('X-req-proxyURL', proxyUrl);
|
||||
|
||||
// }
|
||||
},
|
||||
[env.VITE_APP_BASE_WS]: {
|
||||
target: env.VITE_APP_BASE_URL_WS,
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/dev-ws/, ""),
|
||||
rewrite: (p) => p.replace( `${[env.VITE_APP_BASE_WS]}`, ""),
|
||||
ws: true,
|
||||
//查看真实代理url
|
||||
bypass(req, res, options) {
|
||||
|
||||
const proxyUrl = options.target + options.rewrite(req.url);
|
||||
console.log(proxyUrl);
|
||||
req.headers['X-req-proxyURL'] = proxyUrl;
|
||||
res.setHeader('X-req-proxyURL', proxyUrl);
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user