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 *.mydomain.com
(also including just mydomain.com
) using the cloudflare
certificate provider and uses said wildcard certificate for myservice.mydomain.com
and any other *.mydomain.com
backends you have configured.
This config will reverse proxy all traffic on myservice.mydomain.com
to 192.168.178.233:8080
# Host [http.routers.myservice] rule = "Host(`myservice.mydomain.com`)" service = "myservice" # Backend [http.services] [http.services.myservice.loadBalancer] [[http.services.myservice.loadBalancer.servers]] url = "http://192.168.178.233:8080/" # Certificates [http.routers.myservice.tls] certresolver = "cloudflare" [[http.routers.myservice.tls.domains]] main = "mydomain.com" sans = ["*.mydomain.com"]
Note that cloudflare
in certresolver = "cloudflare"
refers to the provider configured using
--certificatesresolvers.cloudflare....
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
!