我在webpack开发服务器上遇到了一个奇怪的问题。代理记录它正在重写URL,但未对更新的URL发出实际请求(根据快递日志)
这是我得到的输出
[HPM] Rewriting path from "/clients/123abc/plans" to "https://api.mycustomhost.com/api/clients/123abc/plans"
[HPM] GET /clients/123abc/plans ~> https://api.mycustomhost.com/api
[HPM] Rewriting path from "/clients/123abc/plans?type=dc" to "https://api.mycustomhost.com/api/clients/123abc/plans?type=dc"
[HPM] POST /clients/123abc/plans?type=dc ~> https://api.mycustomhost.com/api
[HPM] Rewriting path from "/clients/123abc/plans" to "https://api.mycustomhost.com/api/clients/123abc/plans"
[HPM] GET /clients/123abc/plans ~> https://api.mycustomhost.com/api
我的webpack代理配置
proxy: {
'/clients/**': {
target: options.webpackOptions.endpoint,
changeOrigin: true,
logLevel: 'debug',
secure: false,
pathRewrite: {
'^/clients': (_path) => options.webpackOptions.endpoint + _path
}
}
}
我在做什么错了?
更多信息:
TIA