Purpose: Quick reference for headers that can override or indicate original request URL/path/host/proto. Useful for VAPT, debugging reverse proxies, and hardening.
X-Original-URL— original path before rewrite (IIS, some middlewares)X-Rewrite-URL— original path used by IIS/mod_rewriteX-Forwarded-Uri— full original URI (NGINX Ingress, Traefik, HAProxy)X-Forwarded-Path— path portion forwarded by proxy/CDNX-Forwarded-Host— original Host headerX-Forwarded-Proto— original scheme (httporhttps)Forwarded— standardized header (RFC 7239). Example:Forwarded: for=1.2.3.4;host=example.com;proto=httpsX-Forwarded-For— client IP chainX-Real-IP/X-Real-Host— common custom variants
X-Envoy-Original-Path/X-Envoy-Original-Url(Envoy)X-Original-Uri(Traefik, Istio)X-Request-Uri/X-Request-URL(Tomcat/legacy connectors)X-Rewrite-Path,X-Real-URL,X-Real-URI— custom NGINX or Lua modules
- Path confusion / auth bypass: backend may trust a forwarded header to determine sensitive routes (e.g.
/admin). - Open redirect: building redirect URLs using
X-Forwarded-HostorForwardedcan point users to attacker-controlled hosts. - Cache poisoning: proxies caching responses keyed by host or URL may be poisoned if forwarded headers are trusted.
- SSRF / IP spoofing:
X-Forwarded-FororForwardedcan be manipulated if the app trusts client-supplied IPs.
Send baseline request and then repeat with each header below set to a sensitive path or host. Record changes in response (200, redirect, content differences).
Example payloads:
X-Original-URL: /admin
X-Rewrite-URL: /admin
X-Forwarded-Uri: /admin
X-Forwarded-Path: /admin
X-Envoy-Original-Path: /admin
X-Request-Uri: /admin
Forwarded: for=1.2.3.4;host=admin.example.com;proto=https
X-Forwarded-Host: admin.example.com
X-Forwarded-Proto: https
Steps:
- Request without headers → note response (status, body, headers).
- Request with header(s) → note differences.
- Try combinations (Host + Path + Proto).
- Test for cache poisoning by sending
Hostvariants and subsequent requests from another client/agent. - Test preflight/OPTIONS if the app responds to CORS.
X-Original-URL: /admin
X-Rewrite-URL: /admin
X-Original-Uri: /admin
X-Forwarded-Uri: /admin
X-Forwarded-Path: /admin
X-Envoy-Original-Path: /admin
X-Request-Uri: /admin
X-Request-URL: /admin
X-Forwarded-Host: admin.local
X-Forwarded-Proto: https
Forwarded: for=127.0.0.1;host=admin.local;proto=https
X-Original-Host: admin.local
X-Real-URL: /admin
- Application uses header value to build filesystem path:
fs.readFileSync('/var/www' + header) - Redirects that use forwarded host/scheme:
Location: ${proto}://${host}/...without validation - Authorization decision based on
req.ipwhenX-Forwarded-Foris blindly trusted - Caching/CDN keyed only by path but honoring
X-Forwarded-Host
-
Drop untrusted headers at the edge (reverse proxy) unless explicitly required.
- In NGINX:
proxy_set_header X-Forwarded-Host "";or override with$host.
- In NGINX:
-
Use
Forwardedheader parsing libraries and validate values against allowlists. -
Set
trust proxyappropriately in frameworks (Express:app.set('trust proxy', 'loopback')). -
Normalize and canonicalize incoming paths and hosts before making access decisions.
-
Avoid building redirects from raw forwarded headers — canonicalize host and proto to known values.
-
Separate cache keys by Host/Origin or add
Vary: Originwhen necessary. -
Perform server-side validation: ensure headers point to allowed hosts or known internal paths.
# Remove incoming forwarded headers and set safe values
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# Optional: unset original override headers
proxy_set_header X-Original-URL "";
proxy_set_header X-Rewrite-URL "";-
Inspect listening sockets and bindings:
sudo ss -tulnp | grep LISTEN sudo netstat -tulnp | grep 8000
-
Test header behavior with curl:
curl -I -H "X-Original-URL: /admin" https://example.com/path curl -I -H "Forwarded: for=1.2.3.4;host=admin.local;proto=https" https://example.com/path
- RFC 7239 — Forwarded header: https://tools.ietf.org/html/rfc7239
- OWASP: HTTP Header Injection / Tampering
- Envoy docs: X-Envoy-Original-Path