-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
NodeJS disconnects when "Upgrade" HTTP header is used for example to advertise HTTP/2 support #4334
Comments
@nodejs/http |
@bazzadp Hopefully, I haven't messed up reading HTTP2 spec, but it seems that this is described here: https://http2.github.io/http2-spec/#rfc.section.3.2 From what I could tell the client MUST be the first party to send the Upgrade header. So I am afraid that this is Apache HTTP server that deviating from protocol here. Here is the quote from the RFC 2616 that you have linked here:
This means that after server sends I'm afraid that this issue is won't fix, and should be fixed in mod_h2 instead. Please let me know if you think I am wrong (don't forget to include some arguments, though!). Thanks! |
Hi @indutny, thanks for quick response. Apologies but the link I included was from an old version of the HTTP/1.1 spec (2616). This has been superseded by this one: http://tools.ietf.org/html/rfc7230#section-6.7 7230 includes this section:
Now admittedly 2616 didn't include this paragraph but does look like by that, current, definition the server MAY advertise alternative protocol support over a HTTP/1.1 connection in the way Apache is doing. Thoughts? |
@bazzadp looks like you are right! Thanks for sharing. I will need some time to think about how it could be fixed. |
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: nodejs#4334
Should be fixed by #4337, I guess? |
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: #4334 PR-URL: #4337 Reviewed-By: Ben Noordhuis <[email protected]>
Given the problems this causes, e.g. in mozilla/persona#4231 and keybase/keybase-issues#1925, it would be nice if this gets backported to any open LTS branches. |
@bnoordhuis I'd say it breaks working code if the server starts supporting HTTP2. In this case we probably should stick to the spec. |
It's not me you need to convince, I'm just the messenger. |
@bnoordhuis so what's the best venue if I want to try and do some convincing? |
@djc Convince the people that voiced concerns in the linked issue of the error of their ways. :-) |
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: #4334 PR-URL: #4337 Reviewed-By: Ben Noordhuis <[email protected]>
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: nodejs#4334 PR-URL: nodejs#4337 Reviewed-By: Ben Noordhuis <[email protected]>
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: #4334 PR-URL: #4337 Reviewed-By: Ben Noordhuis <[email protected]>
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: #4334 PR-URL: #4337 Reviewed-By: Ben Noordhuis <[email protected]>
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: nodejs#4334 PR-URL: nodejs#4337 Reviewed-By: Ben Noordhuis <[email protected]>
More details in this issue: icing/mod_h2#73 as this was originally raised with the Apache HTTP/2 project but they have identified this as a Node issue.
Nodejs https (and http) fails to parse certain HTTP responses with an Upgrade header.
This fails:
while this answer succeeds:
Either it is the Upgrade response header or the Upgrade token in the Connection.
To repeat, make a call my site (www.tunetheweb.com) using standard https call like below:
Apache 2.4.18 introduced these headers when using HTTP/2 through the mod_http2 module and NodeJS is now unable to connect to any Apache server using HTTP/2. NodeJS was able to connect using Apache 2.4.17 even when H2 was supported as the upgrade headers were not advertised.
Upgrade headers are part of the HTTP spec (http://www.w3.org/Protocols/rfc2616/rfc2616.txt) and Node should ignore any unsupported upgrade protocol suggestions and continue using HTTP/1.1. Instead it disconnects.
Thanks,
Barry
The text was updated successfully, but these errors were encountered: