Description
Node.JS currently treats Host
as a connection header, and connection headers can't be used in an HTTP/2 request.
TypeError [ERR_HTTP2_INVALID_CONNECTION_HEADERS]: HTTP/1 Connection specific headers are forbidden: "host"
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:
This section shows HTTP/1.1 requests and responses, with
illustrations of equivalent HTTP/2 requests and responses.
An HTTP GET request includes request header fields and no payload
body and is therefore transmitted as a single HEADERS frame, followed
by zero or more CONTINUATION frames containing the serialized block
of request header fields. The HEADERS frame in the following has
both the END_HEADERS and END_STREAM flags set; no CONTINUATION frames
are sent.
GET /resource HTTP/1.1 HEADERS
Host: example.org ==> + END_STREAM
Accept: image/jpeg + END_HEADERS
:method = GET
:scheme = https
:path = /resource
host = example.org
accept = image/jpeg
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 considering host
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.