http-proxy-middleware做代理时,自定义复杂的匹配规则

 

/**
 * @return {Boolean}
 */
const filter = function (pathname, req) {
  return pathname.match('^/api') && req.method === 'GET';
};

const apiProxy = createProxyMiddleware(filter, {
  target: 'http://www.example.org',
});

posted @ 2021-07-09 09:28  徐同保  阅读(226)  评论(0编辑  收藏  举报