Using wildcard certificates in Traefik v2 on Docker Swarm
Looks like you have done everything right. But there is a slight mistake in the config.
main
is the Subject
field for the certificate. Meaning the domain/sub-domain the certificate is being issued to.
sans
is the Subject Alternate Names
field for the certificate. Meaning alternative domain/sub-domain that the certificate is also valid for.
So, Instead of using:
version: "3.7"services: traefik: image: traefik:v2.1 ... labels: - "traefik.http.routers.api.tls.domains[0].main=*.domain.tld" - "traefik.http.routers.api.tls.domains[0].sans=domain.tld" ...
You should use:
version: "3.7"services: traefik: image: traefik:v2.1 ... labels: - "traefik.http.routers.api.tls.domains[0].main=domain.tld" - "traefik.http.routers.api.tls.domains[0].sans=*.domain.tld" ...