Authoritative HTTP header - in hrome dev tools

chrome dev tools - displays some http-header with a lead : (not sure why it works with some and not others).

One of them is the http authority header, which displays as:

authority:api.somedomain.com

However, this is indicated on the list of http headers on Wikipedia. Is this a new HTTP2 header or can any new request field be defined in the headers? Or are they fixed?

+6
source share
1 answer

These are the Pseudo-Header Fields defined in the new HTTP / 2.

HTTP / 1.x used the start-line message to represent the target uri, request method, response code, etc. All HTTP messages are either a request from client to server or a response from server to client. The two types are distinguished by their start-line , which is request-line for requests or status-line for responses.

 request-line = method SP request-target SP HTTP-version CRLF status-line = HTTP-version SP status-code SP reason-phrase CRLF 

You can read more in RFC7230 section 3.1

But for this purpose, HTTP / 2 uses special pseudo-header fields starting with the character ':' (ASCII 0x3a). These pseudo-headers are strictly defined. There are pseudo-header request fields and response pseudo-header fields. Request pseudo-header fields :method :scheme :authority :path .

 The ":authority" pseudo-header field includes the authority portion of the target URI. authority = [ userinfo "@" ] host [ ":" port ] 

More details in RFC7540 .

In HTTP / 1.x, it is equivalent to the host header. RFC7540 mentions some measures for backward compatibility with HTTP / 1.x

"To ensure that the HTTP / 1.1 request string can be reproduced accurately, this pseudo-header field MUST be omitted when translating from an HTTP / 1.1 request to request at the beginning or in the form of an asterisk. Clients that generate HTTP / 2 requests directly SHOULD use the pseudo-header field ": authority" instead of the host header field. An intermediary that converts the HTTP / 2 request to HTTP / 1.1 MUST create a host header field if it is not in the request by copying the value of the header alias field ": authority "

+13
source

All Articles