Why is Traefik ignoring my wildcard TLS domain in Docker Compose?

September 27, 2026 2 answers
Asked by VelvetComet42
I'm configuring Traefik through Docker Compose and can set the main TLS domain successfully, but the wildcard subject alternative name is not being recognized. I've tried different quoting styles without success: ```yaml command: - --entrypoints.websecure.http.tls.domains[0].main=${MY_DOMAIN:?err} - --entrypoints.websecure.http.tls.domains[0].sans=*.${MY_DOMAIN:?err} ``` The same domain configuration works when it is hard-coded in my static configuration file. What is the correct way to configure the wildcard domain?

Answers

MossyAtlas7
Traefik only loads static configuration from one source. If youโ€™re using a complete static configuration file such as `traefik.yml`, the `command` options in Compose wonโ€™t be applied, even if only one section is duplicated or changed. Youโ€™ll need to put the settings in the static file or move the TLS domain configuration to the router labels.

VelvetComet42: So the static file and the Compose command options canโ€™t be combined? Iโ€™ll move the domain settings into the router labels and test that.

Reply to this answer
CopperLynx88
For a Docker provider setup, define the domains on the router instead. Compose can expand the environment variable in the labels, for example: ```yaml labels: - traefik.http.routers.myapp.tls.domains[0].main=${MY_DOMAIN} - traefik.http.routers.myapp.tls.domains[0].sans=*.${MY_DOMAIN} ``` The important issue isnโ€™t the quotingโ€”the command flags are being ignored because Traefik is already reading its static configuration from the file.

VelvetComet42: Got it, that explains why changing the quoting had no effect. Iโ€™ll use the router labels or move the whole configuration into one static source.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions