-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve header case for incoming requests. #1108
base: master
Are you sure you want to change the base?
Conversation
var rawHeaders = {}; | ||
for (var i = 0; i < req.rawHeaders.length - 1; i += 2) { | ||
var key = req.rawHeaders[i]; | ||
rawHeaders[key] = req.rawHeaders[i + 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Learning from #1104, I prefer to use req.headers[key]
instead.
I didn't check the behavior of incoming, though.
I'm welcome this PR, because I didn't care about incoming request. IMO, Existing specs seems not to cover additional behavior. Would you please add specs? |
I think we've just bumped into some problems related to this. Is there a way we can help to get this merged and released? |
It's worth to mention that the http message spec describes headers as a case insensitive. Therefore clients/servers that relays on headers cases sensitivity are not complying with the spec and should not be expected to work properly. |
@jarrodek The issue here is dealing with 3rd party software or legacy software that does not adhere to the spec and we have no control over. |
The same with us. I think node-http-proxy preserving case of header names would be something similar to "be benevolent in what you accept and strict about what you produce". I totally agree it's ridiculous some software is HTTP header name case-sensitive, but software is made by humans and humans make mistakes. This is very simple change node-http-proxy can do and it even actually makes sort of sense - IMHO the proxy should pass things "as is" to be as unnoticeable as possible, unless it really needs to touch them and modify them for some purpose. |
I totally agree with @honzajavorek The proxy should be totally transparent for passing data and not alter them. In this case, however, it doesn't actually changes the data. If anything, that's the problem of Node's Request object and not the proxy. This PR actually introduce a behavior where data are altered by the proxy. This PR should be sent to Node because that's the source of the problem and not this module. |
Just ran into this problem where for whatever reason the service I'm calling expects a header to be Mixed Case ('X-HTTP-Method-Override'). Even with the
|
Just ran into this same issue as @mrichmond described... Why are headers rewritten to lower-case? |
#1107