Forwarded Header Builder
Compose or parse RFC 7239 Forwarded and X-Forwarded-* chains, with hop order, quoting rules and an explicit trust boundary.
Hop editor
2 forwarded elementsOne row per for= element, from the original client on the left to the most recent upstream proxy. The receiving proxy itself is not a row — it writes the last element.
- Hop 1 of 2
- Hop 2 of 2
Generated headers
Forwarded + X-Forwarded-*Forwarded (RFC 7239)
Forwarded: for=203.0.113.7, for=10.0.0.2;proto=https;host=api.example.com
X-Forwarded-* headers
X-Forwarded-For: 203.0.113.7, 10.0.0.2 X-Forwarded-Proto: https X-Forwarded-Host: api.example.com X-Forwarded-Port: 443
IPv6 and any value containing a colon are quoted automatically. Compose mode persists in this tab's local state only.
Advisory model: the trust boundary assumes exactly N proxies you control and the selected hop-order convention. Forwarded and X-Forwarded-* are writable by clients; confirm the result against your real ingress configuration. Header values are processed only in this browser tab.
Examples
Client behind an LB and nginx
Hops: 203.0.113.7, 10.0.0.2
proto=https · host=api.example.comForwarded: for=203.0.113.7, for=10.0.0.2;proto=https;host=api.example.com
X-Forwarded-For: 203.0.113.7, 10.0.0.2Two for= elements describe two upstream peers. The app itself is the receiver and is not emitted as a for= element.
Quoted IPv6 node
Forwarded: for="[2001:db8::1]:443"Node 2001:db8::1 · port 443 · kind ipv6 · no findingsColons are not token characters, so the address is bracketed and the whole node is a quoted-string. An unquoted form is flagged with the bracketed fix.
Five-hop XFF chain with two trusted proxies
203.0.113.7, 198.51.100.22, 10.0.0.2, 10.0.0.3, 10.0.0.4Hops 1–3 untrusted · hops 4–5 trusted · client IP: 10.0.0.2With T=5 and N=2 the untrusted prefix is T−N=3; the first trusted proxy saw 10.0.0.2, even though the leftmost value claims to be 203.0.113.7.
Mixed-header conflict
XFF: 203.0.113.7, 10.0.0.2, 10.0.0.3
Forwarded: for=10.0.0.9, for=10.0.0.2Warning: 3 hops vs 2 elements · client conflict: 203.0.113.7 vs 10.0.0.9When both dialects describe the same request but disagree, the incident report records both values instead of silently choosing one.
About this tool
Reverse proxies sit between your users and your app, and the only record of where a request came from is a handful of headers. This tool builds and reads both dialects: the standardized Forwarded header from RFC 7239 and the de-facto X-Forwarded-For/Proto/Host/Port family. Compose a chain from an ordered hop editor, or paste headers from a request dump to see a hop-by-hop table with the source header for every value.
RFC 7239 uses comma-separated elements, semicolon-separated parameters and token or quoted-string values. `for=` and `by=` carry node ids: IPv4 addresses, bracketed IPv6, FQDNs, the literal `unknown` and obfuscated `_`-prefixed identifiers, each with an optional port. A colon is not a token character, so any port-bearing node and every IPv6 address must be a quoted-string. The composer quotes them for you; the parser reports the exact offending value and suggests the quoted form when a pasted header gets it wrong.
The X-Forwarded-* family has no formal grammar and different ordering conventions. X-Forwarded-For is normally appended: each proxy adds the peer it received the request from, so the rightmost value was added by the nearest proxy and the leftmost values are the ones a client can influence. X-Forwarded-Proto, -Host and -Port are normally overwritten at each hop, which is why a single value is applied to every hop here, while a comma-separated list is aligned by position when its length matches XFF. When both dialects are pasted, count mismatches and conflicting client or proto values are called out explicitly.
The trust-boundary control is the point of the tool. Tell it how many proxies you actually control and which convention your chain uses; it colours the trusted suffix or prefix, marks the last untrusted hop as the client IP your nearest trusted proxy really saw, and generates receiver-side configuration such as Express `trust proxy`, Envoy `xff_num_trusted_hops` and nginx `set_real_ip_from`. The boundary is advisory: headers are user-writable below your outermost trusted proxy, and no pasted value is sent anywhere.
What this tool does not do
- Only Forwarded and X-Forwarded-For/Proto/Host/Port are modeled; CDN-specific headers such as CF-Connecting-IP, True-Client-IP and Fastly-Client-IP are not interpreted.
- The trust boundary is advisory: it assumes the configured proxies are the only ones between the client and your application and that you know their ordering convention.
- Header lists are parsed as a single request snapshot; no correlation with real network hops, TLS peer certificates or proxy logs is performed.
- X-Forwarded-Proto/Host/Port position alignment is a best-effort interpretation of multi-valued headers; most deployments send one value per header.
- Obfuscated identifiers are preserved as opaque tokens. The tool does not de-obfuscate registry-based ids or resolve FQDNs to addresses.
- IPv6 validation checks syntax and bracket placement, not address assignment, scope zones or IPv4-mapped address semantics.
- No request is sent anywhere and no chain is stored, but pasted client data stays in the tab until you clear or reload it; avoid pasting sensitive production captures on an untrusted machine.
How to use this tool
Choose a mode
Use Compose to author a chain from scratch, or Parse to inspect headers you already have. Example chips load realistic chains, including deliberately broken ones.
Compose hops
Add one row per forwarded element, from the original client on the left to the most recent upstream proxy; the receiving app is not a row. Fill in node values, optional ports, by= interfaces and per-hop proto/host fields, then set the shared X-Forwarded-* values.
Or paste headers
In Parse mode, paste Forwarded field lines and/or the X-Forwarded-For/Proto/Host/Port set. Header-name prefixes and line breaks are accepted. Use the dialect conversion button to turn a pasted XFF chain into a single Forwarded header.
Set the trust boundary
Enter the number of proxies you control and pick append (rightmost = nearest proxy) or prepend (leftmost = nearest). The chain, the client-IP verdict and the receiver snippets update immediately.
Copy the result
Copy the generated header bundle, the suggested client IP, a proxy configuration snippet or the Markdown incident report with the hop table and every finding.
Use cases
Wire up an ingress chain
Compose the Forwarded and X-Forwarded-* headers an LB, nginx or Envoy should emit, then copy the matching sender snippet with the correct append behavior.
Extract a client IP safely
Paste a captured chain, set the number of trusted proxies and copy the hop your nearest trusted proxy actually saw instead of trusting the leftmost value.
Audit a header dump after an incident
Compare Forwarded with X-Forwarded-For, see count and value conflicts, unusual whitespace, duplicate hops and private ranges in public chains, then export a Markdown report.
Grammar and conventions at a glance
| Input | Behavior |
|---|---|
| Forwarded element separator | A comma starts a new element; multiple Forwarded field lines are treated as one comma-joined list. |
| Parameter separator | A semicolon separates for=, by=, proto= and host= pairs. Parameter names are case-insensitive; BWS around '=' is allowed. |
| for / by node | IPv4, FQDN, [IPv6], `_obfuscated` or `unknown`, optionally followed by a numeric or `_hidden`-style port. Values containing ':' must be quoted. |
| Quoted-string | Backslash-escaped quotes and semicolons or commas inside quotes stay in one value; non-ASCII characters are preserved byte-for-byte. |
| X-Forwarded-For | Comma-separated values, trimmed for display but preserved raw in the table. Bare and bracketed IPv6 are accepted here. |
| X-Forwarded-Proto/Host/Port | One value is applied to every hop (the normal overwritten-at-each-hop behavior); a list matching the hop count is aligned positionally, and other counts raise a warning. |
| Trust convention | append: rightmost N hops are yours, client is the last untrusted hop. prepend: leftmost N hops are yours, client is the first untrusted hop. |
Unknown Forwarded parameters are preserved and flagged as informational; they are never silently discarded.
Common mistakes
Mistake:Treating the leftmost X-Forwarded-For value as the client IP without knowing the trust boundary.
Fix:Only the hops added by proxies you control are trustworthy. With N trusted proxies in append mode, use the last untrusted hop — the address your nearest trusted proxy received.
Mistake:Overwriting X-Forwarded-For with $remote_addr instead of appending.
Fix:Use proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for in nginx; overwriting destroys the chain and makes every trust decision wrong.
Mistake:Writing unquoted IPv6 or a bare port in a Forwarded header.
Fix:RFC 7239 node ids with ':' must be quoted-strings with the IPv6 address in brackets: for="[2001:db8::1]:443". The composer does this automatically.
Mistake:Assuming the X-Forwarded-Proto list has one entry per XFF hop.
Fix:Proto, Host and Port are normally overwritten at each hop, so a single value is typical. The tool applies a single value to every hop and aligns a list only when its length matches the hop count.
Mistake:Deleting obfuscated ids or `unknown` because they look malformed.
Fix:`_hidden` and `unknown` are valid RFC 7239 node ids meaning 'withheld' and 'unknown'. They are parsed and rendered distinctly, never rewritten into a real IP.
Mistake:Trusting a Forwarded header from a client-facing request.
Fix:Any client can send these headers. Configure your outermost proxy to replace them, and configure the receiver to trust only your own hops; the boundary here is advisory, not a security verdict.
Frequently asked questions
Is X-Forwarded-For appended or prepended?
The common convention is append: each proxy adds the peer it received the request from to the right, so the leftmost value is the original client and the rightmost value was added by the nearest proxy. Some stacks prepend instead, putting the nearest proxy on the left. Use the convention toggle in Parse mode; it changes both the trust boundary and the client-IP verdict.
Which X-Forwarded-For hop can I trust?
Only values written by proxies you control. With T hops and N trusted proxies in append mode, the rightmost N hops are yours and the leftmost T−N are attacker-writable. The value your nearest trusted proxy actually saw is the last untrusted hop (index T−N−1), not necessarily the leftmost value a client supplied.
How do I forward IPv6 correctly?
In RFC 7239 Forwarded, ':' is not a token character, so an IPv6 node must be bracketed and the whole value quoted: for="[2001:db8::1]:443" or for="[2001:db8::1]" without a port. X-Forwarded-For has no quoting convention, so bare 2001:db8::1 and bracketed [2001:db8::1] are both accepted there. This tool quotes IPv6 on compose and flags unquoted IPv6 on parse with the bracketed fix.
What are obfuscated identifiers such as for=_hidden or for=unknown?
RFC 7239 defines `unknown` as a literal meaning the sender does not know the node, and obfuscated ids beginning with `_` as a way to hide an address, for example a registry-based identifier like _hidden. They are distinct concepts: `unknown` is a literal, `_`-prefixed values are obfuscated tokens. Both are valid node ids and are preserved verbatim rather than replaced by a guessed IP.
Should I use Forwarded or X-Forwarded-*?
Prefer Forwarded where your proxies support it: it is an RFC with a real grammar, a `by=` parameter and escaped quoted-strings. X-Forwarded-* remains the de-facto standard and is often the only option in older ingress chains. The tool emits both from one hop model so you can migrate safely and compare them side by side.
Why does my Forwarded header need quotes around a port?
RFC 7239 pairs are `token BWS "=" BWS (token / quoted-string)`, and a token cannot contain a colon. `for=203.0.113.7:443` is therefore invalid; `for="203.0.113.7:443"` is the correct form. A port-only node such as `for=:8443` is also invalid because a nodename is mandatory before the optional port.
What if I paste both Forwarded and X-Forwarded-For?
The tool builds one unified hop table, aligns the two dialects by position and flags count mismatches, conflicting client addresses and conflicting proto values. Raw values and source headers stay visible in the table, so an incident report can record exactly which header supplied each hop.
How are X-Forwarded-Proto, -Host and -Port aligned with hops?
These headers are normally overwritten at each hop, so a single value is the healthy case and is applied to every hop here. If you paste a comma-separated list with exactly as many values as XFF hops, the values are aligned positionally. Any other count produces a warning and only the values that fit are applied.
Does the trust boundary tell me if a request is safe?
No. It is an advisory model based on the number of proxies you tell it you control and the selected hop-order convention. Real deployments can have hidden proxies, misconfigured ingress, CDNs that add their own headers or clients that spoof values. Verify the result against your actual proxy configuration and logs.
Can I generate proxy configuration from the boundary setting?
Yes. Parse mode emits sender snippets for nginx, Traefik and Envoy and receiver-side trust snippets for nginx, Express, Envoy and Traefik. The receiver snippets reflect the trusted-proxy count, for example app.set("trust proxy", N) and xff_num_trusted_hops: N; replace the sample CIDRs with the networks your proxies actually use.
Can I export a report for an incident?
Yes. The Markdown report includes the trust assumptions, the client-IP verdict, a hop table with raw values, proto, host, source header and trust annotations, and up to the first twenty findings with suggested fixes. You can copy it or download it as a .md file.
Are pasted headers sent to a server or stored?
No. Parsing, quoting, conflict detection and snippet generation all run in this browser tab. There is no network request, no localStorage entry and no account. The compose model lives only in component state, and everything disappears when you reload or close the tab.
References & standards
Related tools
API Mock Server
Define mock REST routes and intercept fetch calls client-side
AsyncAPI Validator
Validate AsyncAPI 2.x and 3.x documents offline, browse channels and messages, and check protocol binding coverage.
Bandwidth Calculator
Estimate how long a file takes to transfer at a given connection speed — correctly handling bits vs bytes (Mbps vs MB/s) and SI vs binary size units
Bandwidth-Delay Product Calculator
Compute BDP from bandwidth and RTT: required TCP window, scaling factor, in-flight MSS and buffer notes. Auditable math, entirely in your browser.
Broken Link Checker
Extract http(s) links from pasted HTML and check them via proxy
Bulk Redirect Map Generator
Generate nginx map blocks, Apache RedirectMatch rules, Netlify _redirects and vercel.json from one old-to-new URL list, with status codes, wildcards and conflict detection.