Multiple domains Let's encrypt certificates in labels

Hello,

I currently use Cloudflare to obtain wildcard certificates from a domain I own with Traefik labels in my docker-compose.yml:

labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik.domain.com`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=USER:BASIC_AUTH_PASSWORD"
      - "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.domain.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=domain.com"
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain.com"
      - "traefik.http.routers.traefik-secure.service=api@internal"

I owned another domain I also want to use with Traefik. Is it possible to add these labels in the same file?

      - "traefik.http.routers.traefik-secure.tls.domains[1].main=domain2.com"
      - "traefik.http.routers.traefik-secure.tls.domains[1].sans=*.domain2.com"

Thanks!

Yep. That is the way.

2 Likes

Ok, thank you cakiwi!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.