| | |
| | | ], |
| | | }, |
| | | server: { |
| | | |
| | | proxy: { |
| | | '/basic-api': { |
| | | target: 'http://localhost:3000', |
| | | target: 'http://yingchen.onbus.cn:9010', |
| | | changeOrigin: true, |
| | | ws: true, |
| | | rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''), |
| | | bypass(req, res, options: any) { |
| | | const proxyURL = options.target + options.rewrite(req.url); |
| | | console.log("客户端请求的真正地址:", proxyURL); |
| | | res.setHeader("REAL-URL", proxyURL); // 设置响应头在浏览器中可见 |
| | | } |
| | | // only https |
| | | // secure: false |
| | | }, |
| | |
| | | ws: true, |
| | | rewrite: (path) => path.replace(new RegExp(`^/upload`), ''), |
| | | }, |
| | | |
| | | }, |
| | | open: true, // 项目启动后,自动打开 |
| | | warmup: { |
| | | clientFiles: ['./index.html', './src/{views,components}/*'], |
| | | }, |
| | | } |
| | | }, |
| | | }, |
| | | }); |