DevToolsmith

Forwarded Header

The Forwarded request header the standard form of the X-Forwarded-* headers: client address, protocol and host in one header.

Type
Request header
Category
Proxies
Defined in
RFC 7239

Syntax

Forwarded: for=<client>;proto=<http|https>;host=<host>[, for=<proxy>]

How Forwarded works

Defined in RFC 7239, it combines what X-Forwarded-For, -Proto and -Host carry. IPv6 addresses and ports must be quoted. Adoption is still patchy, so most infrastructure sends the X-Forwarded headers, and some sends both.

Examples

IPv4 and IPv6 hops
Forwarded: for=192.0.2.60;proto=https;host=example.com, for="[2001:db8:cafe::17]:4711"

Check it

# Show the request headers curl sends (lines starting with >)
curl -sv -o /dev/null https://example.com 2>&1 | grep '^>'

Paste a full set of response headers into the HTTP header checker to get every header explained and common mistakes flagged.

Related headers

  • X-Forwarded-For: carries the original client IP address through proxies and load balancers.
  • X-Forwarded-Proto: tells the application whether the client connected over HTTPS or HTTP, when TLS ends at a proxy.
  • Host: names the domain (and port) the request is for, so one server can host many sites.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What does the Forwarded header do?

The Forwarded request header the standard form of the X-Forwarded-* headers: client address, protocol and host in one header. Defined in RFC 7239, it combines what X-Forwarded-For, -Proto and -Host carry. IPv6 addresses and ports must be quoted. Adoption is still patchy, so most infrastructure sends the X-Forwarded headers, and some sends both.

How do I see the Forwarded header?

Open your browser’s dev tools, select a request in the Network tab and look under Request Headers. On the command line, "curl -v https://example.com" prints the request headers it sends, marked with ">".