Host Header
Table of Content
In the HTTP protocol, the Host
header field specifies the domain name of the server (for virtual hosting), and (optionally) the TCP port number on which the server is listening. The Host
field value is a string representing the server's authority. It plays a crucial role in HTTP/1.1 to allow a single server to host multiple domains or interfaces.
Syntax
Host: <host>:<port>
Directives
Host : The domain name of the server.
Port : (Optional) The TCP port number where the server is listening.
Examples
Host: www.example.com
Host: www.example.com:8080
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Host header
ModHeader is a Chrome extension that allows users to manipulate HTTP request headers.
To use ModHeader to modify the Host
header:
- Install and click on the ModHeader icon in the toolbar.
- In the Request Headers section, click + to add a new header
- Enter "Host" in the header name field, and the desired domain in the header value field
Modifying the Host
header can be incredibly useful for testing server behavior (on servers supporting virtual hosting), routing, load balancing scenarios, SEO auditing (to assess response for different locations) and many more.