caddy icon indicating copy to clipboard operation
caddy copied to clipboard

caddyhttp: use the new http.Protocols to handle h1, h2 and h2c requests

Open WeidiDeng opened this issue 9 months ago • 4 comments

Golang 1.24 introduced a new type that can be used to specify the versions of http caddy can handle. Now caddy can support h2/h2c without h1.

This new mechanism also means graceful shutdown for h2 is easier and we no longer need to track the number of h2 connections. It does require another hack to prevent unintentional h2c request handling, but that hack is minimal.

H2c via protocol upgrade is no longer supported. As far as I know, only curl with use this upgrade if --http2-prior-knowledge is not specified.

WeidiDeng avatar Apr 17 '25 03:04 WeidiDeng

Can you link the relevant Go PRs/commits? Curious to see how that evolved.

francislavoie avatar Apr 17 '25 03:04 francislavoie

Is there anything in reverseproxy that can be simplified with the new h2c stuff? Or did they only improve the server side but not client side?

francislavoie avatar Apr 17 '25 03:04 francislavoie

I want to wait until 6955 is merged to work on the reverse proxy protocol stuff.

WeidiDeng avatar Apr 17 '25 04:04 WeidiDeng

This is still in draft state; would you like another review?

mholt avatar May 06 '25 22:05 mholt