Hop-by-hop headers: when a client can make a proxy drop the headers that carry trust
How the Connection header lets a client ask a proxy to strip named headers, why that matters when a backend trusts a header the proxy adds, and how to test and configure proxies so it cannot remove security headers.
Diagram
A proxy removing a header on request
Step 1 of 4
Proxy adds
The edge sets X-Forwarded-For or X-Auth-User for the backend.
# Proxy adds # The edge sets X-Forwarded-For or X-Auth-User for the # backend.
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Fallbacks are the bug
- What fails
- Stripping a header only hurts when the backend treats its absence as permission.
- Who is affected
- Whatever the default identity can reach.
- What you would notice
- Backend code that defaults to an internal or admin context when a header is missing.
- What you change
- Fail closed: missing identity headers mean 401.
Proxy chains differ
- What fails
- Each proxy in a chain may handle Connection differently.
- Who is affected
- Apps behind CDNs, load balancers, and ingress controllers.
- What you would notice
- Behavior that changes when a request goes through a different hop.
- What you change
- Test the full chain and pin proxy versions and settings.
Information leaks too
- What fails
- Removing a header can change caching or routing and reveal internal behavior.
- Who is affected
- Users of shared caches.
- What you would notice
- Different responses when standard headers are listed in Connection.
- What you change
- Normalize Connection at the edge.
Testing in a staging chain
For each header the edge adds, send a request that names it in Connection and compare the response with the normal request. Identical behavior is the goal. Any difference in authentication, caching, or routing is a finding to report with the hop that strips it.
baseline: GET /api/me -> 200 {"user":"ana"}
Connection: close, X-Auth-User GET /api/me -> 200 {"user":"service"} <- backend fell backConfiguration notes
RFC 9110 lets intermediaries remove headers listed in Connection. Configure the edge to set trust headers itself, overwrite any client copies, and not honor client-supplied hop-by-hop lists for headers it manages.
Check yourself
Recognition and the fix. Nothing here is a procedure.
A backend treats a missing X-Auth-User as the internal service account. What is the fix?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.