Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should the HTTP/2 `:authority` header include port number?

Tags:

http2

Following on from Is Port Number Required in HTTP "Host" Header Parameter?, does the same logic apply to HTTP/2?

i.e. if a browser makes a request to https://server.com:1234/, should the :authority header be server.com or server.com:1234?

like image 911
ioquatix Avatar asked Apr 26 '18 04:04

ioquatix


People also ask

Should HTTP host header include port?

The Host request header specifies the host and port number of the server to which the request is being sent. If no port is included, the default port for the service requested is implied (e.g., 443 for an HTTPS URL, and 80 for an HTTP URL). A Host header field must be sent in all HTTP/1.1 request messages.

What is http2 authority header?

The HTTP/2 :authority pseudo-header is a stricter, mandatory, information about the host authority (i.e. host name and host port). In HTTP/1.1, the host authority is derived from multiple sources, and may even be absent, causing a number of confusing behaviors that depend on server implementations.

What is http2 port?

Hypertext Transfer Protocol version 2 (HTTP2) The well known TCP port for HTTP/2 traffic is 443 (and 80).

What are the designed features of the HTTP 2 protocol?

HTTP/2 Features Some key features of HTTP/2 include: Binary: Meaning commands use 1s and 0s and not text. Multiplex: Permits multiple requests and responses to be sent at the same time. Compression: Compresses headers that have been requested previously to make things more efficient.


1 Answers

It should, :authority is defined by RFC 7540 (https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2.3) as a :

pseudo-header field includes the authority portion of the target URI ([RFC3986], Section 3.2). The authority MUST NOT include the deprecated "userinfo" subcomponent for "http" or "https" schemed URIs.

RFC 3986 in turn describes authority as:

  authority   = [ userinfo "@" ] host [ ":" port ]

So yes, it should include the port, if the port isn't the default for the scheme.

like image 125
Frederik Deweerdt Avatar answered Oct 20 '22 17:10

Frederik Deweerdt