Feature: 怎么统一给代理的请求添加前缀
RosApr opened this issue · 3 comments
RosApr commented
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Issue Checklist
- I have checked for other similar issues
- I have explained why this change is important
- I have added necessary documentation (if appropriate)
jaywcjlove commented
proxy: {
// Turn a path string such as `/user/:name` into a regular expression.
// https://www.npmjs.com/package/path-to-regexp
'/repos/(.*)': 'https://api.github.com/',
'/:owner/:repo/raw/:ref/(.*)': 'http://127.0.0.1:2018',
'/api/repos/(.*)': 'http://127.0.0.1:3721/'
},
@RosApr 你通过这个实力配置改成自己的配置。
RosApr commented
_proxy: {
proxy: {
pathRewrite: {
'/api/*': '/$1',
},
},
},
就是我想把前端所有带api的请求,
都把api这个字段去掉
但是我这么写还是有问题
RosApr commented
proxy: { // Turn a path string such as `/user/:name` into a regular expression. // https://www.npmjs.com/package/path-to-regexp '/repos/(.*)': 'https://api.github.com/', '/:owner/:repo/raw/:ref/(.*)': 'http://127.0.0.1:2018', '/api/repos/(.*)': 'http://127.0.0.1:3721/' },@RosApr 你通过这个实力配置改成自己的配置。
谢谢回复