Forwarded
RequestActiveThe Forwarded header is the RFC 7239 standardized replacement for X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto. A single Forwarded header can carry the client IP (for=), receiving host (host=), protocol (proto=), and proxy identity (by=). It is more structured and extensible than the X-Forwarded-* family, though X-Forwarded-For remains more widely deployed.
Description
RFC 7239 defines the Forwarded header to unify the ad-hoc X-Forwarded-* headers. The structured format uses semicolons to separate parameters per hop and commas to separate multiple hops. Each hop can specify for= (client IP, can be obfuscated as _hidden or _secret), by= (receiving proxy), host= (original Host header), and proto= (original scheme). IPv6 addresses must be quoted: for="[2001:db8::1]".
Directives
| Directive | Description |
|---|---|
| for= | Client IP address. Can be IPv4, quoted IPv6, or obfuscated (_hidden). |
| by= | Identity of the proxy that added this header. |
| host= | Original Host header value from the client. |
| proto= | Protocol used by client: http or https. |
Examples
Forwarded: for=203.0.113.195;proto=https;host=example.comForwarded: for=203.0.113.195, for=70.41.3.18Forwarded: for="[2001:db8::1]";proto=httpsForwarded: for=_secret;by=_proxy1;host=api.example.com;proto=https