URL looks like: host:port/a/b/c
Want to map "a" to a host, ie host2:port2, and rewrite to host2:port2/b/c.
There doesn't seem to be a mechanism in place to do such a thing.
It requires adding a middleware for this that would do such redirects. I have added such feature to https://github.com/RushPL/rush-http-proxy (which is based on node-http-proxy). You may see how it is implemented there (in case you use http-proxy as a module) or otherwise just use my CLI tool.
I determined this is actually brain-dead simple, and perhaps why it's not a specific request.
// proxy requests to target
proxy.proxyRequest(req, res, TARGET_SERVER);
To rewrite the URL prior to proxy, simple do:
req.url = "/foo";
Of course you can add any logic necessary to the rewrite. Didn't realize it was that simple.
I no longer think there is a need for this as a middleware or a "feature"