Search code examples
node.jsproxynode-http-proxy

node-http-proxy pathRewrite with url params


Is there a convenient way with node-http-proxy to rewrite an entire url including params?

I would like to do something similar to this:

module.exports = () => ({
  "customer/:customerId":"customer?id=:customerId"
});

So I want that the customerId for example gets rewritten to a url parameter named id.

Is that possible with node-http-proxy or an extension?


Solution

  • Found it: https://www.npmjs.com/package/express-request-proxy

    This solves the issue