headers parameter missing in response.writeHead calls #412

ghost opened this Issue Apr 28, 2013 · 3 comments

2 participants


For versions > 0.8.7, reponse.writeHead in the httpProxy.createServer call back does not receive the headers parameter. Only the statusCode is passed.


I ran into this the other day too, as the older version I was using was passing the headers into the writeHead() function. Looks like this commit is what changed the previous behavior, in that setHeader is now used to add all the headers. ffe74ed#L0L284

After reading the node docs it appears the headers parameter for writeHead is optional and it sounds like setHeader() does a better job of handling normalizing/duplicates, I am guessing that is the reason for the switch??

Anyways, what I ended up doing when I override writeHead is use the this._headers object within my new writeHead function to retrieve/modify the headers instead of relying on the headers parameter being filled in. Not sure if that is the absolute best way but seems to be working. Hope that helps...


I don't see any examples of how to modify headers. I'm having a bit of trouble with the above methods. Anybody have any insight? http://stackoverflow.com/questions/17174862/modify-headers-of-proxied-request

nodejitsu member

We have proper headers support in the latest version of http-proxy please open a new issue if this is still a problem

@jcrugzz jcrugzz closed this Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment