Host Header Explained

What the HTTP Host header does and when it's used.

Published October 15, 2026

Host specifies the domain name (and optional port) of the server the client wants, enabling many sites on one IP address (virtual hosting).

How it works

It is mandatory in HTTP/1.1. In HTTP/2 the equivalent is the :authority pseudo-header.

The Host header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
Host: example.com
Where Host appears.

Practical examples

The header

Host: example.com

Set or use it in code

server { server_name example.com; }

Inspect it

curl -sI https://example.com | grep -i 'host'

Common mistakes

  • Trusting Host for generating password-reset links (host header injection)
  • Missing it behind proxies
  • Not forwarding it in reverse proxies

Key takeaways

  • Host: Host specifies the domain name (and optional port) of the server the client wants, enabling many sites on one IP address (virtual hosting).
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

Why is it required?

So one IP can serve many domains.

Is Host case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles