reverseproxy: Support HTTP/3 transport to backend #6312
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
VERY EXPERIMENTAL. Enables HTTP/3 protocol from proxy to backend ("upstream").
I still don't fully understand why this would be needed/useful, but here is a quick stab attempt with the APIs available to us.
Enabling HTTP/3 necessarily disables other HTTP versions. (If you specify version "3" in your config, you cannot have any other versions.) We do not support protocol downgrade or negotiation like web browsers do. That would probably add considerable latency and complexity where you should already have control over the backends. Additionally, other HTTP transport options don't apply to the HTTP/3 round-tripper because it does not use the
http.Transport
type like the lower HTTP versions.Example Caddyfile:
Then run
curl -v "http://localhost:1234/"
and you'll see the response on the front-end using HTTP/1.1, but the proxy used HTTP/3 to the backend.In the backend (:1235) we log the request so you can verify that it shows
"proto": "HTTP/3.0"
for the proxied request. The frontend (:1234) will log"proto": "HTTP/1.1"
.Anyway, this seems to work, but with the limitations I mentioned above. We have similar, albeit slightly less tight, restrictions on the "h2c" transport as well.
(@marten-seemann You might like to know we're trying this.)
Closes #5086