-
-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Description
我想在访问 http://localhost/api/client/xxx
的时候,代理到 http://10.1.44.95:8080/sz/api/
,所以我写了如下配置:
/* eslint-disable */
const delay = require('mocker-api/utils/delay');
const proxy = {
_proxy: {
proxy: {
'/api/client/(.*)': 'http://10.1.44.95:8080/sz/api/'
},
changeHost: true,
},
};
module.exports=delay(proxy, 0);
但是在请求的时候还是会把/api/client
带过去
$ curl http://localhost:3721/api/client/12
{"timestamp":1576654898376,"status":404,"error":"Not Found","message":"Not Found","path":"/sz/api/api/client/12"}
我想要的效果是访问 http://localhost:3721/api/client/12
, 就代理到 /sz/api/12
看到 webpack 里面可以用 pathRewrite,单独使用没有找到设置方法
试了好多配置,貌似没有效果啊。。
Metadata
Metadata
Assignees
Labels
No labels