-
Notifications
You must be signed in to change notification settings - Fork 30k
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
HTTP/2 Host header disallowed #29858
Comments
@mildsunrise +1 for this. |
+1 I'm trying to use AWS transcribe streaming which requires a host header to be present because it is signed before sending the request. See https://docs.aws.amazon.com/transcribe/latest/dg/how-streaming.html -> "Required Headers" |
@codedrift Fortunately they also seem to allow |
Awesome! Thank you very much! |
@mildsunrise So i adapted your library and it works perfectly! 🚀 |
The HTTP/2 spec allows Host to be used instead of :authority in requests, and this is in fact *preferred* when converting from HTTP/1. We erroneously treated Host as a connection header, thus disallowing it in requests. The patch corrects this, aligning Node.js behaviour with the HTTP/2 spec and with nghttp2: - Treat Host as a single-value header instead of a connection header. - Don't autofill :authority if Host is present. - The compatibility API (request.authority) falls back to using Host if :authority is not present. This is semver-major because requests are no longer guaranteed to have :authority set. An explanatory note was added to the docs. Fixes: nodejs#29858
Node.JS currently treats
Host
as a connection header, and connection headers can't be used in an HTTP/2 request.I'm not sure it should be considered a connection header. The HTTP/2 spec recommends using the
Host
header instead of:authority
if you are converting from an HTTP/1 request. This is an excerpt of the examples section:I think the correct behaviour would be for Node.JS to allow
host
, and omit auto-filling:authority
if it's supplied.The current behaviour was there from the very introduction of
http2
(#14239), so I'm not sure if there was a special motivation for consideringhost
a connection header? Does it interact with something else?I don't know what we should do... But I strongly think we should at least give users a way to supply
host
without an error.The text was updated successfully, but these errors were encountered: