Using Traefik with multiple domains

traefik

I'm trying to setup dockerized version of traefik with two domains and certs generated with Let's Encrypt.

I've modified traefik.toml to look like this:

[acme]
  email = "email@example.com"
  storage = "acme.json"
  entryPoint = "https"
  OnHostRule = true

[[acme.domains]]
   main = "domain1.com"
[[acme.domains]]
   main = "domain2.com"

And in the docker-compose I've added these labels:

labels:
  - "traefik.frontend.rule=Host:test-1.domain2.com"
  - "traefik.enable=true"
  - "traefik.port=80"

When I try to access a container on domain1.com with labels changes accordingly (frontend.rule), the cert is OK.

When I try to access a container on domain2.com though (test-1.domain2.com), the cert is self signed by traefik.

Can someone please point me in the right direction to setup both domains working with Let's Encrypt properly?

Best Answer

Sorry, about the misleading information. Due to my complex environmnet my previous test was not correct and my reply to your previous answer is not correct.

I do verify that switching to the dnsChallenge does generate and properly use a new certificate for the other domain. Thanks for pointing me in the right direction.

Related Topic