Repository navigation
outposts/proxy: don't negotiate HTTP/2 to upstreams - #26281
Conversation
The Go outpost this replaced used a bare `http.Transport{TLSClientConfig: ..}`
and never set `ForceAttemptHTTP2`, which per net/http "conservatively disables
HTTP/2", so upstreams were only ever spoken to over HTTP/1.1. The Rust port's
`.enable_all_versions()` changed that, and it breaks HTTP/2-capable backends
two ways.
Ordinary requests become malformed: the outpost forwards the client's inbound
`Host` while hyper derives `:authority` from the upstream URI, and when they
differ that is malformed under RFC 9113 8.3.1, so compliant upstreams answer
400. WebSocket upgrades are silently dropped: `Upgrade` and `Connection` are
forbidden in HTTP/2 (8.2.2) so hyper strips them before sending, the backend
sees a plain GET, and no 101 ever comes back (8.6).
Keeping HTTP/2 and fixing the authority mismatch would mean decoupling
`:authority` from the dial target, which hyper_util's legacy Client cannot do:
its pool key is `(scheme, authority)` and the connector dials that same tuple.
Also fixes two pre-existing bugs in the same path: pin the proxied request to
HTTP/1.1 so an inbound HTTP/2 request is not rejected by the pool with
`UserUnsupportedVersion`, and compare upgrade tokens case-insensitively, since
protocol names are case-insensitive (RFC 9110 7.8) and a backend answering
`Upgrade: WebSocket` currently gets a spurious 502.
Adds the first tests for reverse_proxy.rs, covering the request version, that
the inbound Host is forwarded unchanged, the host_header override, hop-by-hop
removal, and the case-insensitive upgrade comparison.
closes goauthentik#25388
closes goauthentik#25409
refs goauthentik#25643
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26281 +/- ##
==========================================
+ Coverage 92.00% 92.05% +0.04%
==========================================
Files 1175 1175
Lines 76288 76503 +215
Branches 4056 4121 +65
==========================================
+ Hits 70192 70422 +230
+ Misses 6054 6028 -26
- Partials 42 53 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
rissson
left a comment
There was a problem hiding this comment.
apart from a nit, the tests are not passing
Co-authored-by: Marc 'risson' Schmitt <[email protected]> Signed-off-by: The Ginger <[email protected]>
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Looking into the tests |
|
Anything else youd want from my end on this? |
|
🍒 Cherry-pick to |
… to version-2026.8) (#26342) Co-authored-by: The Ginger <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Marc 'risson' Schmitt <[email protected]> Signed-off-by: The Ginger <[email protected]>
AI assistance disclosure
Per AI_POLICY.md:
Tool: Claude (Anthropic), driven agentically via Claude Code.
Extent: AI-assisted throughout — reading the 2026.8.x and 2026.5.7 outpost
sources, building and deploying patched images against a live deployment, and
running the reproductions below. Every status code, log line and table entry
quoted here is real command output, not model-generated text.
Human-in-the-loop: I have read and verified this change and take
responsibility for its contents.
Details
What does this PR change?
The proxy outpost no longer negotiates HTTP/2 to upstream applications:
set_host(false)is deliberately left alone, so upstreams keep receiving theclient's
Hostheader exactly as before.Two small pre-existing bugs in the same path are fixed alongside:
*request.version_mut() = Version::HTTP_11increate_proxied_request— aninbound HTTP/2 request would otherwise be rejected by the HTTP/1.1 pool with
UserUnsupportedVersion.case-insensitive (RFC 9110 §7.8), so a backend answering
Upgrade: WebSocketcurrently gets a spurious 502.
Why is this change needed?
This restores the Go outpost's behaviour. At
version/2026.5.7,internal/outpost/proxyv2/application/mode_proxy.go:No
ForceAttemptHTTP2— which pernet/http.Transport"conservatively disablesHTTP/2". The Go outpost never spoke HTTP/2 to upstreams.
.enable_all_versions()in the Rust port is the entire delta, and it breaks HTTP/2-capable backends in
two distinct ways.
1. Ordinary requests are malformed. The outpost forwards the client's
inbound
Hostwhile hyper derives:authorityfrom the upstream URI. When theydiffer that is malformed under RFC 9113 §8.3.1 and compliant upstreams reject
it. nginx with
error_log debugnames it exactly:The 400 the browser sees is the upstream's own error page, proxied back, which
makes this look like an application fault rather than an outpost one.
2. WebSocket upgrades are silently dropped.
UpgradeandConnectionareconnection-specific and forbidden in HTTP/2 (§8.2.2), so hyper strips them before
sending; the backend receives a plain
GET, answers normally, andcall()neversees a
101. HTTP/2 has no101at all (§8.6).Demonstrated with one WebSocket echo backend behind three listeners on the same
nginx — same certificate, same proxy config — differing only in negotiated
protocol, logging what arrives:
up="-"shows the headers are absent on arrival, so the backend is notresponsible.
Keeping HTTP/2 and fixing the authority mismatch is not a small change: it means
decoupling
:authorityfrom the dial target, whichhyper_util::client::legacycannot do — its pool key is
(scheme, authority)and the connector dials thatsame tuple. That is a design change, not a regression fix.
How was this tested?
On a live deployment with eight proxy providers, before and after:
https://…:8443https://…/https://…:11443/http://…:3000http://…:30116/The UniFi case exercises the WebSocket path specifically: its SPA will not
populate without
/api/ws/system, and it additionally requires theOriginhost to equal
Hoston the upgrade — which holds precisely because this PR keepsforwarding the client's
Host.Also verified against the echo rig above that all three listeners, including the
h2-capable one, now return
101.Linked issues
closes #25388
closes #25409
closes #25643