Traefik wildcard Lets Encrypt certificate reverse proxy example

The following example builds on our config from Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges

This config (placed in /etc/traefik/conf/myservice.toml - which is mapped to ./conf/myservice.toml i.e. /opt/traefik/conf/myservice.toml in our docker-compose example) generates a wildcard certificate for * (also including just using the cloudflare certificate provider and uses said wildcard certificate for and any other * backends you have configured.

This config will reverse proxy all traffic on to

# Host
rule = "Host(``)"
service = "myservice"

# Backend
url = ""

# Certificates
certresolver = "cloudflare"
main = ""
sans = ["*"]

Note that cloudflare in certresolver = "cloudflare" refers to the provider configured using


but you can choose any other name with the cloudflare method such as --certificatesresolvers.myprovider.acme.dnschallenge.provider=cloudflare in which case the provider will be referred to as myprovider !