The ":authority" pseudo-header field includes the authority portion of the target URI. authority = [ userinfo "@" ] host [ ":" port ] Read more in RFC7540. In HTTP/1.x, it is equivalent with host header field. In RFC7540, some measures are mentioned for backward compatibility with HTTP/1.x.
These are Pseudo-Header Fields
defined in the new HTTP/2.
HTTP/1.x used the message start-line
to represent target URI, method of request, response code, etc. All HTTP messages are either request from the client to the server or response from the server to the client. These 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 HTTP/2 uses special pseudo-header fields beginning with ':' character (ASCII 0x3a) for this purpose. These pseudo-headers are strictly defined. There are request pseudo-header fields and response pseudo-header fields. Request pseudo-header fields are :method
, :scheme
, :authority
, :path
.
The ":authority" pseudo-header field includes the authority portion of the target URI.
authority = [ userinfo "@" ] host [ ":" port ]
Read more in RFC7540.
In HTTP/1.x, it is equivalent with host
header field. In RFC7540, some measures are mentioned for backward compatibility with HTTP/1.x
To ensure that the HTTP/1.1 request line can be reproduced accurately, this pseudo-header field MUST be omitted when translating from an HTTP/1.1 request that has a request target in origin or asterisk form. Clients that generate HTTP/2 requests directly SHOULD use the ":authority" pseudo-header field instead of the Host header field. An intermediary that converts an HTTP/2 request to HTTP/1.1 MUST create a Host header field if one is not present in a request by copying the value of the ":authority" pseudo-header field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With