hoxy icon indicating copy to clipboard operation
hoxy copied to clipboard

de-capitalizing headers produces server errors with some backends

Open bradgearon opened this issue 11 years ago • 4 comments
trafficstars

suggestion is to use title case or not modify headers that have been set does this seem plausible?

bradgearon avatar Aug 11 '14 18:08 bradgearon

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)

greim avatar Aug 12 '14 06:08 greim

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 avatar Mar 17 '15 06:03 sholladay

@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).

greim avatar Mar 17 '15 17:03 greim

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.

sholladay avatar Mar 19 '15 01:03 sholladay