reverseproxy: add webtransport Caddyfile subdirective

Adds a `webtransport` subdirective to the `transport http {}` block of
reverse_proxy that sets the new WebTransport bool on the transport.
Takes no arguments; exclusivity with versions 3 is enforced at
Provision time so parse order doesn't matter.

Example:
    reverse_proxy https://backend:9443 {
        transport http {
            versions 3
            webtransport
            tls_insecure_skip_verify
        }
    }

Includes a Caddyfile-to-JSON adapt test round-tripping the new
subdirective.
This commit is contained in:
tomholford 2026-04-22 00:50:18 -07:00
parent 1998be8e4d
commit bcc6f03196
2 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,47 @@
:8443
reverse_proxy https://backend:9443 {
transport http {
versions 3
webtransport
tls_insecure_skip_verify
}
}
----------
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":8443"
],
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"tls": {
"insecure_skip_verify": true
},
"versions": [
"3"
],
"webtransport": true
},
"upstreams": [
{
"dial": "backend:9443"
}
]
}
]
}
]
}
}
}
}
}

View file

@ -1315,6 +1315,15 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
return d.ArgErr()
}
case "webtransport":
// Accepts no arguments: `webtransport` alone enables it.
// Exclusivity with `versions 3` is enforced at Provision
// time so parsing is order-independent.
if d.NextArg() {
return d.Errf("webtransport does not take arguments")
}
h.WebTransport = true
case "compression":
if d.NextArg() {
if d.Val() == "off" {