http-proxy-middleware 可以拦截 完全url的请求吗

例如用http 库发起的这种请求
http({
url:'https://www.baidu.com/kkk/kkk',
methods:'get'
})
http-proxy-middleware 好像无法拦截

var filter = function (pathname, req) {
console.log(pathname)
return pathname.match('/restful');
}
app.use(proxyMiddleware(filter, {
target: 'https://www.baidu-test.com/',
changeOrigin: true,
}))

输出的pathname 没有相关的url

阅读 2.8k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题