node-http-proxy
node-http-proxy copied to clipboard
Modify http-proxy target in runtime?
trafficstars
Hi, sorry for all my questions. I want my http-proxy to connect to different targets depending on information I receive in the client request header. I have created a header and pass the hostname to the target I want to proxy to in the client request.
proxy.on('proxyReq', function(proxyReq, req, res, options) {
_server = proxyReq.getHeader('server-hostname');
//proxyReq.host = _server;
but that does not seem to work. Is it even possible to change the target's host in run-time?
best regards Fredrik