How to implement QUIC prtocol using caddy

Hey guys, I am pretty new in the caddy, so I would like to implement QUIC protocol in my project. Do you guys have any good documentation to implement that? because I can not find it yet. kindly needed for your help. Also, I wish to support both TCP and UDP in my server. for such a situation caddy plugin is suitable …?

You’re looking for the experimental_http3 global option:

QUIC is now being standardized as HTTP3

Thanks for your quick replay. I installed caddy 2 through docker and it successfully runs on 127.0.0.1. My main problem is how to connect my caddy into my golang project…?. What are the steps need to connect my golang project?

. this is my sample program

This package has a HTTP/3 client you can build on: https://github.com/lucas-clemente/quic-go/

i want to build my project top off caddy.

You’re looking to reverse proxy:

The easiest way to proceed would probably be to simply design your project to use a net/http server listening on a higher port, and make being reverse-proxy friendly a priority so that users of your project can put it behind a central HTTPS-managing server like Caddy.

If you want it to be Caddy-like all on its own, you can look into the library that powers Caddy’s HTTPS capabilities - CertMagic: https://github.com/caddyserver/certmagic/

With that, you’d do pretty much the same (structure your program with a request router like you would if you were going to use a net/http server), except you’d wrap it in the CertMagic listener for all the Automatic HTTPS goodness.

Thank you sir, by doing this way it automatically support http3 or QUIC protocol ?

i am curently using caddy 2 , i want to make my server working based on QUIC, inorder do that what should i do…?

If you have your app behind Caddy, your clients will benefit from the ability to use whatever protocols are supported by Caddy. HTTP/3 is advertised as a supported protocol on Caddy’s homepage, so you should be good there. HTTP/3 is still draft, though, I understand, so support can be flaky… for everyone.

sir Thanks for your replay, i didn’t want reverse proxy, My actual requirement is , i want to make my sever working based on QUIC protocol. inorder to do that in my golang project what should i do…? , please help me

If you don’t want to use Caddy as a reverse proxy and benefit from Caddy’s support, and you want clients to connect directly to your Golang application with QUIC / HTTP/3, then the best place we can advise you to look is here, as mentioned earlier by Matt:

Specifically, the “As a server” section should be a helpful example for you.

If you want to build a project as a Caddy app (i.e. alongside the HTTP server app), you could look at this instead: https://caddyserver.com/docs/extending-caddy

i tried that. but it doesn’t work :pensive:

That’s not a useful answer. We can’t help you if you don’t give anything back. Just saying “it doesn’t work” is completely useless to both you and us. We can’t continue to help you if you don’t help yourself by elaborating on what the actual problem is.

This topic was automatically closed after 30 days. New replies are no longer allowed.