You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http.request.proto is wonky for HTTP/2 and HTTP/3 (there’s no such thing as “HTTP/2.0” or “HTTP/3.0”) #7734
I wonder how people actually use http.request.proto. Feels icky for it to be exposing incorrect implementation details from Go’s net/http, but it seems quite plausible that such a variable is mostly being used by other things with similar wrongness.
Thanks for the background, I’d found a part of the source stuff but not all (I don’t use Go). It’s nice to learn history and reasons and such.
For me, I guess I can map it myself, something like this in Caddyfile:
Chris is right that the spec-style names are HTTP/2 and HTTP/3 but I do not think we should change {http.request.proto} in place. This is exposing Go’s http.Request.Proto, which uses the HTTP/<major>.<minor> shape and quic-go intentionally changed HTTP/3 from HTTP/3 to HTTP/3.0 in quic-go/quic-go@990b1fe to fix #4819, as mentioned by Weidi. That matters because this value can flow into CGI/FastCGI-style SERVER_PROTOCOL expectations.
I think the right fix is likely documentation for {http.request.proto} stating that it reflects Go’s protocol string and can be HTTP/2.0 or HTTP/3.0. If we want spec-style protocol names for templates/placeholders, I would add a separate normalised placeholder rather than changing this one and risking compatibility regressions with with Go/CGI-compatible protocol version syntax.
The shape makes sense to me. But I am not fully sold on http.request.proto_standard as the final name, mostly because “standard” is a bit ambiguous here, {http.request.proto} already follows Go/CGI-compatible protocol-version syntax while the new placeholder would be the spec-style protocol token so technically {http.request.proto} follows a standard itself.
Maybe {http.request.proto.name} is clearer? Then the distinction is:
{http.request.proto}= Go http.Request.Proto / CGI-compatible protocol version, e.g. HTTP/2.0, HTTP/3.0
{http.request.proto.name}= spec-style protocol name, e.g. HTTP/2, HTTP/3
I think the placeholder name we land with should make the distinction obvious enough that users do not expect one to replace the other.
Activity
WeidiDeng commentedon May 17, 2026
This two values actually comes from upstream,
For http2,
https://github.com/golang/net/blob/f8651996b24ba47d89dd9eb97fd47758e6d1886f/http2/server.go#L2218
For http3,
https://github.com/quic-go/quic-go/blob/a72e083d99ad7b72708a210ec09aefcb0f73f2e1/http3/headers.go#L254
I agree that's unexpected for anything not familiar with go, but even stdlib can't parse valid http version like
HTTP/2🤷 .Also, for http3 it's used to be
HTTP/3, but it broke caddy, and it was patched to returnHTTP/3.0.But sure, caddy has a long way to go regarding documentation.
chris-morgan commentedon May 17, 2026
I wonder how people actually use
http.request.proto. Feels icky for it to be exposing incorrect implementation details from Go’s net/http, but it seems quite plausible that such a variable is mostly being used by other things with similar wrongness.Thanks for the background, I’d found a part of the source stuff but not all (I don’t use Go). It’s nice to learn history and reasons and such.
For me, I guess I can map it myself, something like this in Caddyfile:
steadytao commentedon May 17, 2026
Chris is right that the spec-style names are
HTTP/2andHTTP/3but I do not think we should change{http.request.proto}in place. This is exposing Go’shttp.Request.Proto, which uses theHTTP/<major>.<minor>shape and quic-go intentionally changed HTTP/3 fromHTTP/3toHTTP/3.0in quic-go/quic-go@990b1fe to fix #4819, as mentioned by Weidi. That matters because this value can flow into CGI/FastCGI-styleSERVER_PROTOCOLexpectations.I think the right fix is likely documentation for
{http.request.proto}stating that it reflects Go’s protocol string and can beHTTP/2.0orHTTP/3.0. If we want spec-style protocol names for templates/placeholders, I would add a separate normalised placeholder rather than changing this one and risking compatibility regressions with with Go/CGI-compatible protocol version syntax.francislavoie commentedon May 18, 2026
We could add something like
http.request.proto_standardor something (name is open for discussion) instead of changing the existing placeholdersteadytao commentedon May 18, 2026
The shape makes sense to me. But I am not fully sold on
http.request.proto_standardas the final name, mostly because “standard” is a bit ambiguous here,{http.request.proto}already follows Go/CGI-compatible protocol-version syntax while the new placeholder would be the spec-style protocol token so technically{http.request.proto}follows a standard itself.Maybe
{http.request.proto.name}is clearer? Then the distinction is:{http.request.proto}= Gohttp.Request.Proto/ CGI-compatible protocol version, e.g.HTTP/2.0,HTTP/3.0{http.request.proto.name}= spec-style protocol name, e.g.HTTP/2,HTTP/3I think the placeholder name we land with should make the distinction obvious enough that users do not expect one to replace the other.
francislavoie commentedon May 18, 2026
I think
proto_namemakes sense. More of a sibling than nesting or property-ofcaddyhttp: add {http.request.proto_name} placeholder for spec-complia…
caddyhttp: add {http.request.proto_name} placeholder for spec-complia…