caddy/modules/caddyhttp
tomholford 43adbee168 caddyhttp, reverseproxy: gate WebTransport behind enable_webtransport server flag
steadytao raised an architectural concern in review of #7669: the PR
put experimental WebTransport handling directly into Caddy's core
HTTP/3 accept path, so every HTTP/3 deployment paid for the feature
whether or not they used it.

Collapse the enablement surface to a single server-level opt-in that
matches Caddy's existing precedent for protocol-level features
(`protocols`, `allow_0rtt`, `enable_full_duplex`), and detect the
request shape at the handler the same way `reverse_proxy` detects a
WebSocket upgrade today — no per-handler config flag.

Core HTTP/3 path changes (modules/caddyhttp/server.go):
  * New `EnableWebTransport bool` field on Server, marked EXPERIMENTAL.
  * buildHTTP3Server now only calls webtransport.ConfigureHTTP3Server
    and sets EnableStreamResetPartialDelivery when the flag is true.
    When false, the constructed http3.Server is bit-for-bit identical
    to the pre-WebTransport implementation.
  * wtServer is constructed only when the flag is true.
  * serveH3AcceptLoop falls back to http3.Server.ServeListener when
    the flag is false — no varint peek, no per-connection dispatch.

Caddyfile wiring (caddyconfig/httpcaddyfile/serveroptions.go):
  * New `enable_webtransport` global server option, modeled on
    `enable_full_duplex`.

Reverse-proxy simplifications (modules/caddyhttp/reverseproxy/):
  * Removed HTTPTransport.WebTransport field and its Provision-time
    exclusivity check (no longer needed; H3 is validated separately).
  * Removed the `webtransport` Caddyfile subdirective under
    `transport http { }` — this neutralizes the prior commit that
    introduced it.
  * Removed Handler.webtransportEnabled cache. ServeHTTP now branches
    on isWebTransportExtendedConnect(r) alone, matching how the
    WebSocket upgrade branch works.
  * serveWebTransport gains fail-fast guards with clear errors when
    the parent server has enable_webtransport=false or when the
    handler's transport does not include HTTP/3.

Tests:
  * Existing TestServer_BuildHTTP3ServerEnablesWebTransport now sets
    EnableWebTransport=true explicitly; new
    TestServer_BuildHTTP3ServerWithoutWebTransport locks in the
    regression guard that flag-off produces the pre-PR http3.Server.
  * Integration tests updated: enable_webtransport: true added to
    every H3 server block; "webtransport": true dropped from the
    reverse_proxy transport JSON (auto-detected now).
  * Caddyfile adapt test for the deleted `webtransport` subdirective
    is removed; `enable_webtransport` is added to the existing
    global_server_options_single adapt test alongside its peers.

No runtime behavior change when enable_webtransport is false. Diff
against master on the core HTTP/3 path is effectively zero in that
configuration.
2026-06-23 19:04:24 +09:00
..
caddyauth caddyauth: add candidate placeholders for rejected identities (#7698) 2026-05-20 13:51:54 +00:00
encode encode: add standard benchmark and conformance harness (#7804) 2026-06-11 17:55:18 -06:00
fileserver browse: Update Caddy logo 2026-06-20 13:45:10 -06:00
headers chore: Enable modernize linter (#7519) 2026-02-26 14:01:35 -07:00
intercept intercept: fix replace_status being silently dropped (#7810) 2026-06-12 15:50:58 -06:00
logging logging: log_append Early option, Supports {http.response.body} (#7368) 2025-12-16 23:42:42 -05:00
map chore: Use slices package where possible (#6585) 2024-09-25 14:30:56 -06:00
proxyprotocol docs: expand proxy protocol docs (#6620) 2024-10-10 16:21:26 -04:00
push chore: Dumb prealloc lint fix (#7430) 2026-01-13 14:13:43 -05:00
requestbody chore: ugh, lint fix... (#7275) 2025-09-26 03:14:48 -04:00
reverseproxy caddyhttp, reverseproxy: gate WebTransport behind enable_webtransport server flag 2026-06-23 19:04:24 +09:00
rewrite rewrite: scope keyed query replace to its named key (#7818) 2026-06-16 01:01:05 +10:00
standard caddyhttp: move WebTransport echo handler to integration tests 2026-06-23 19:04:24 +09:00
templates templates: Patch for GHSA-vcc4-2c75-vc9v (#7785) 2026-06-01 13:35:02 -06:00
tracing tracing: fix BatchSpanProcessor goroutine leak on config reload (#7826) 2026-06-18 11:42:58 -06:00
app.go caddyhttp: add terminating WebTransport handler 2026-06-23 19:04:23 +09:00
autohttps.go tls: add alpn to managed HTTPS records (#7653) 2026-05-10 13:10:29 +10:00
autohttps_test.go tls: add alpn to managed HTTPS records (#7653) 2026-05-10 13:10:29 +10:00
caddyhttp.go caddyhttp: Add MatchWithError to replace SetVar hack (#6596) 2024-11-04 23:18:50 +00:00
caddyhttp_test.go caddyhttp: Add test cases to corpus (#6374) 2024-06-04 14:23:55 -06:00
celmatcher.go chore: clean up wording and typo fixes (#7745) 2026-05-20 16:36:30 +10:00
celmatcher_test.go caddyhttp: add URL pattern request matcher (#7787) 2026-06-22 10:25:43 -06:00
errors.go use math/rand/v2 instead of math/rand (#7413) 2026-02-11 09:15:51 -07:00
http2listener.go chore: clean up wording and typo fixes (#7745) 2026-05-20 16:36:30 +10:00
httpredirectlistener.go chore: clean up wording and typo fixes (#7745) 2026-05-20 16:36:30 +10:00
invoke.go caddyhttp: Implement named routes, invoke directive (#5107) 2023-05-16 15:27:52 +00:00
ip_matchers.go caddyhttp: refactor to use reflect.TypeFor (#7187) 2025-08-18 17:08:46 -06:00
ip_range.go Move PrivateRangesCIDR() back: add a pass-through function (#6514) 2024-08-12 05:47:05 -04:00
logging.go core: custom slog handlers for modules (log contextual data) (#7346) 2025-11-12 13:29:47 -07:00
marshalers.go admin: Redact sensitive request headers in API logs (#7578) 2026-04-17 14:56:42 -06:00
matchers.go http: normalize method names to uppercase in MatchMethod.Provision (#7832) 2026-06-21 08:19:21 +00:00
matchers_test.go http: normalize method names to uppercase in MatchMethod.Provision (#7832) 2026-06-21 08:19:21 +00:00
metrics.go metrics: Implement pushing via OLTP (#7664) 2026-04-25 06:52:08 -04:00
metrics_test.go metrics: Implement pushing via OLTP (#7664) 2026-04-25 06:52:08 -04:00
replacer.go caddyhttp: add {http.request.proto_name} placeholder for spec-compliant protocol names (#7782) 2026-06-04 11:03:19 -04:00
replacer_test.go caddyhttp: add {http.request.proto_name} placeholder for spec-compliant protocol names (#7782) 2026-06-04 11:03:19 -04:00
responsematchers.go caddyhttp: Allow matching Transfer-Encoding, add to access logs (#6629) 2024-12-20 11:16:34 -07:00
responsematchers_test.go
responsewriter.go caddyhttp: add UnwrapResponseWriterAs helper 2026-06-23 19:04:23 +09:00
responsewriter_test.go caddyhttp: add UnwrapResponseWriterAs helper 2026-06-23 19:04:23 +09:00
routes.go chore: Fix golangci-lint 2.12.1 findings (#7690) 2026-05-07 03:40:26 -04:00
server.go caddyhttp, reverseproxy: gate WebTransport behind enable_webtransport server flag 2026-06-23 19:04:24 +09:00
server_test.go caddyhttp, reverseproxy: gate WebTransport behind enable_webtransport server flag 2026-06-23 19:04:24 +09:00
staticerror.go caddyhttp: run error (msg) through replacer (#6536) 2024-08-22 11:32:44 -06:00
staticresp.go chore: Add nolints to work around haywire linters (#7493) 2026-02-17 16:52:54 -07:00
staticresp_test.go
subroute.go
urlpatternmatcher.go caddyhttp: add URL pattern request matcher (#7787) 2026-06-22 10:25:43 -06:00
urlpatternmatcher_test.go caddyhttp: add URL pattern request matcher (#7787) 2026-06-22 10:25:43 -06:00
vars.go caddyhttp: Clean up variable scope in vars matcher 2026-06-20 13:45:10 -06:00
vars_test.go vars: Add matcher placeholder handling tests (#7640) 2026-04-10 16:27:52 -06:00