mirror of
https://github.com/caddyserver/caddy.git
synced 2026-06-30 13:53:03 +00:00
Extends the http reverse-proxy transport with a webtransport boolean
that opts the upstream into WebTransport passthrough. Must be combined
with versions: ["3"]; WebTransport rides on HTTP/3 exclusively.
When enabled, Handler.ServeHTTP detects Extended CONNECT with
:protocol=webtransport early — before any of the normal round-trip
machinery — and branches to serveWebTransport, which:
1. Pulls the *webtransport.Server off caddyhttp.Server (via
WebTransportServer()) and errors out cleanly if HTTP/3 isn't
enabled on the frontend.
2. Picks a single upstream through the configured load-balancer.
No retries: a failed dial closes the client session and returns.
3. Walks the response-writer Unwrap() chain to reach the raw http3
writer and calls webtransport.Server.Upgrade to terminate the
incoming session.
4. Uses dialUpstreamWebTransport to open a session to the selected
upstream, forwarding request headers on the Extended CONNECT.
5. Runs runWebTransportPump between the two sessions and blocks
until both close.
The transport's wtTLSConfig is built at Provision time from the
existing TLS config (same path h3Transport already uses) and reused
for every session.
Tests: adds TestWebTransport_ReverseProxyEndToEnd which spins up a
single Caddy instance with two HTTP/3 servers — one proxy on :9443,
one terminating echo upstream on :9444 — and drives a real
webtransport.Dialer through the proxy to assert end-to-end
bidirectional-stream echo.
|
||
|---|---|---|
| .. | ||
| fastcgi | ||
| forwardauth | ||
| addresses.go | ||
| addresses_test.go | ||
| admin.go | ||
| admin_test.go | ||
| ascii.go | ||
| ascii_test.go | ||
| buffering_test.go | ||
| caddyfile.go | ||
| client_disconnect_test.go | ||
| command.go | ||
| copyresponse.go | ||
| dynamic_upstreams_test.go | ||
| headers_test.go | ||
| healthchecks.go | ||
| hopheaders_test.go | ||
| hosts.go | ||
| httptransport.go | ||
| httptransport_test.go | ||
| metrics.go | ||
| passive_health_test.go | ||
| retries_test.go | ||
| reverseproxy.go | ||
| selectionpolicies.go | ||
| selectionpolicies_test.go | ||
| streaming.go | ||
| streaming_test.go | ||
| upstreams.go | ||
| upstreams_test.go | ||
| webtransport_pump.go | ||
| webtransport_pump_test.go | ||
| webtransport_transport.go | ||
| webtransport_transport_test.go | ||