X-Host

The HTTP X-Host request header is an unofficial header set by reverse proxies and load balancers to preserve the original hostname from the client's request.

Usage

When a reverse proxy forwards a request to a backend server, the Host header in the forwarded request typically reflects the backend's hostname rather than the hostname the client originally requested. The X-Host header carries the original value so backend applications retain access to the original hostname.

A client requests www.example.re. The reverse proxy forwards the request to an internal backend at backend-01.internal. The Host header in the forwarded request now reads backend-01.internal. X-Host is added to carry www.example.re so the backend knows which hostname the client addressed.

X-Host serves the same purpose as X-Forwarded-Host and the standardized Forwarded header's host parameter. The three headers differ in origin and format. Forwarded is the IETF standard. X-Forwarded-Host is the older de facto convention with wide adoption. X-Host is a shorter variant used by some proxy configurations. All three convey the original Host value.

Backend applications use the original hostname for URL generation, redirect construction, canonical link resolution, and virtual host routing.

Note

The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.

Values

The value is the original hostname as received in the client's Host header. This is typically a domain name, with or without a port number.

Common formats:

  • www.example.re: standard domain without port
  • example.re:8080: domain with explicit port

Example

A reverse proxy forwards a request from a client originally addressing www.example.re. The backend receives the original hostname via X-Host.

X-Host: www.example.re

When the client request includes a non-standard port, the port is preserved in the X-Host value.

X-Host: api.example.re:8080

Some proxy configurations send both X-Host and X-Forwarded-Host for compatibility with backends expecting either header.

X-Host: www.example.re
X-Forwarded-Host: www.example.re

Takeaway

The X-Host header preserves the original Host header value across reverse proxy hops, giving backend applications access to the hostname the client addressed, performing the same role as X-Forwarded-Host and the standard Forwarded header.

See also

Last updated: March 6, 2026