Host

The HTTP Host request header indicates the hostname of the server the HTTP request is being sent to.

Usage

The HTTP Host request header is included by the client to specify the host and the port to which the HTTP request is being sent. If no port is included then it is assumed to be 80 for an HTTP Connection or port 443 for an HTTPS connection.

This HTTP header is mandatory in HTTP/1.1 requests. If the server receives a HTTP request that does not include this HTTP header then it will return the HTTP error 400 Bad Request. The same error HTTP status code will be returned if more than a single HTTP Host header is included.

Example

Request

Host: example.re

Takeaway

The HTTP Host header specifies the server-side host and port that the message is intended for.

See also

Last updated: August 2, 2023