I'm struggling to understand how to set Traefik up for multiple TLDs within docker and have it pull their certs. Here's my docker-compose.yml:
version: '3'
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
environment:
- CF_API_EMAIL=
- CF_API_KEY=- /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - /root/traefik/data/traefik.yml:/traefik.yml:ro - /root/traefik/data/acme.json:/acme.json - /root/traefik/data/config.yml:/config.yml:ro labels: - "traefik.enable=true" - "traefik.http.routers.traefik.entrypoints=http" - "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.myfirstdomain.com`,`myseconddomain.com`)" - "traefik.http.middlewares.traefik-auth.basicauth.users=user:<hashedKey>" - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https" - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https" - "traefik.http.routers.traefik.middlewares=traefik-https-redirect" - "traefik.http.routers.traefik-secure.entrypoints=https" - "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.myfirstdomain.com`)" - "traefik.http.routers.traefik-secure.middlewares=traefik-auth" - "traefik.http.routers.traefik-secure.tls=true" - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare" - "traefik.http.routers.traefik-secure.tls.domains[0].main=local.myfirstdomain.com" - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.local.myfirstdomain.com" - "traefik.http.routers.traefik-secure.tls.domains[1].main=myseconddomain.com" - "traefik.http.routers.traefik-secure.tls.domains[1].sans=*.myseconddomain.com" - "traefik.http.routers.traefik-secure.service=api@internal"
networks:
proxy:
external: true
Can anyone say what I might be doing wrong?
Right now it's pulling the certs for the first domain, but not the second.