hoxy
hoxy copied to clipboard
de-capitalizing headers produces server errors with some backends
suggestion is to use title case or not modify headers that have been set does this seem plausible?
Node's http module translates incoming header names to lowercase. https://github.com/joyent/node/issues/1954
So we're stuck with this behavior under node v0.10 but apparently, coming versions will provide a rawHeaders property which should allow Hoxy to pass header names unmodified. I'll leave this open for now and at some point need to ensure tests pass on bleeding-edge node, then can address this issue. (At which point the fix will entail using node v0.11.x or higher)
Node 0.12.0 is out and support for this is now possible, for anyone willing to implement it. https://nodejs.org/api/http.html#http_message_rawheaders
When doing so, I would personally appreciate making it configurable, since this is spec breaking behavior.
@sholladay - As long as headerReceived.toLowerCase() === headerSent.toLowerCase() would it be spec-breaking? I probably need to read up on the nuances but was under the impression headers were case insensitive, e.g. CoNtEnT-TyPe would be spec-valid (although not probably handled well by some servers in the wild).
Correct. What I mean to say is that needing this as a feature is effectively spec-breaking, as it shows you are failing to NOT care about the casing of headers. But I do like choices and for a proxy in particular, it makes sense to be as transparent as possible unless otherwise desired.