node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Modify http-proxy target in runtime?

Open fsallstrom opened this issue 5 years ago • 1 comments
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

fsallstrom avatar Jul 04 '20 11:07 fsallstrom