Contents

Traefik: Enable Http3

Enable Http3 with Traefik using Docker Compose

Change Docker Compose File

Because http/3 uses UDP we need to also take care of the firewall that usually blocks UDP traffic on HTTPS Port 443.

To enable http3 in Traefik V3, add the following to your docker-compose.yml file:

services:
  traefik:
    image: traefik:v3
    container_name: "traefik"
    restart: unless-stopped
    command:
    - "--providers.docker=true"
    - "--providers.docker.exposedbydefault=false"
    - "--entryPoints.websecure.address=:443"
    # Add the following lines
    - "--entrypoints.websecure.http3=true"
    - "--entrypoints.websecure.http3.advertisedport=443"
    ports:
    # Docker only exposes TCP by default, so we need to expose UDP as well
    - "443:443/tcp"
    - "443:443/udp"

Test if http3 is enabled

 ╭─traefik@www.vaduzz.de in repo: garden on  main [!?] took 0s
 ╰─λ curl -Iv --http3 https://www.vaduzz.de
* Host www.vaduzz.de:443 was resolved.
[...]
* using HTTP/3
* [HTTP/3] [0] OPENED stream for https://www.vaduzz.de/
* [HTTP/3] [0] [:method: HEAD]
* [HTTP/3] [0] [:scheme: https]
* [HTTP/3] [0] [:authority: www.vaduzz.de]
* [HTTP/3] [0] [:path: /]
* [HTTP/3] [0] [user-agent: curl/8.15.0]
* [HTTP/3] [0] [accept: */*]
> HEAD / HTTP/3
> Host: www.vaduzz.de
[...]