Skip to main content

Forwarded

RequestActive

The 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.

Forwarded: for=<node>[;by=<node>][;host=<host>][;proto=<http|https>][, for=<node>...]

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

DirectiveDescription
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

Single proxy
http
Forwarded: for=203.0.113.195;proto=https;host=example.com
Proxy chain
http
Forwarded: for=203.0.113.195, for=70.41.3.18
IPv6 client
http
Forwarded: for="[2001:db8::1]";proto=https
Obfuscated proxy
http
Forwarded: for=_secret;by=_proxy1;host=api.example.com;proto=https

Related

Specification

RFC 7239Forwarded specification →