My boring Blog

Mauro Frigerio blog

Activate HTTP/3 in traefik

28-07-2022 2 min read article

Do you want to make your site accessible faster? Then you need to try the new version of the HTTP protocol or rather its version number 3 or also called HTTP/3. the most common browsers already support this protocol and many already take advantage of it without realizing they are using it.

According to a report by Cloudflare 30% of Internet traffic already exploits this capability. What is new is the change of protocol for the transport layer from TCP to UDP (differences and the integration of TLS. Added between UDP and HTTP is the new QUIC protocol, originally devised by Google. If you are interested in some details I recommend this video.

Activate HTTP/3 in traefik

First you need an instance of traefik with a domain and its working TLS certificate. If you are not yet at this point, first consult this guide.

Traefik HTTP/3 support still at the experimental level as of version 2.5. Activation is very simple and just add the following settings to the docker-compose file (a full example is available on GitHub).

    image: traefik:v2.8
    container_name: traefik
      - "--entrypoints.web-secure.address=:443"
      - "--entrypoints.web-secure.http3"    # <== ADD
      - "--experimental.http3=true"         # <== ADD
      - 80:80
      - 443:443/tcp       # <== CHANGE
      - 443:443/udp       # <== ADD

After saving the docker-compose file you have to recreate the traefik container with the command:

sudo docker-compose up -d traefik

How to test the utilization of HTTP/3?

In Firefox, you can open the inspect tab (right-click) and then you have to choose the Network tab. Often you need to display the Protocol column. Now you can reload the desired page and if everything works correctly in the Protocol column appears: HTTP/3.

If you discover problems in this guide or in the configuration files, you can open an issue on GitHub. Thank you!