Enable HTTP/3 on Caddy with Docker

TL;DR Explicitly expose port 443/udp on your Docker command/docker-compose file.

On September 20th 2022, Caddy 2.6 was released and HTTP/3 became default settings. Well, now you don't need an obscure option to enable it! However, when I checked my (this) website on http3check, it seems HTTP/3 wasn't supported. I read that HTTP/3 is enabled automatically and no new settings is needed on Caddy. And that HTTP/3 is using UDP too.

Enabling UDP on port 443 with ufw, I checked again. Still doesn't support HTTP/3. What's wrong?

Turns out you need to explicitly forward UDP to the Docker container, and the bare port option 443:443 only opens the TCP port.

Here's the port config:

    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"

The 443:443/udp is the one config you need to explicitly write. Afterwards, checking again this site supports HTTP/3!

A note, you need to have at least Caddy version 2.6.0 for default HTTP/3 support.

P.S. http3check still mentioned that QUIC is not supported. But somehow when I scanned caddyserver.com, http3check mentioned it doesn't support QUIC as well. I guess I need to dive again to see what's wrong.