← LAB NOTEBOOK · REPORT LN-2611-16 · TIL · DNS · ● VERIFIED

A wildcard DNS record can send your certificate challenge to the wrong place

A catch-all record at the top of my zone turned the ACME challenge name into an alias. My certificate client followed it, wrote the proof somewhere else, and Let's Encrypt said no.

RESULT

Production issuance failed with a 403 until I told the client not to follow CNAMEs. With LEGO_DISABLE_CNAME_SUPPORT=true it wrote the challenge in the right place and the trusted certificate was issued.

Nothing builds false confidence like a test environment that passes.

I was setting up a wildcard certificate for my lab apps (the full setup is here). I did the responsible thing and used Let’s Encrypt’s staging server first. The staging certificate came back in 19 seconds. I switched to production, feeling quietly professional.

Production answered with a 403.

What was going on

To prove I own lab.example.com, the ACME client writes a TXT record at _acme-challenge.lab.example.com, and Let’s Encrypt looks it up.

My zone had an old catch-all record at the top: * as a CNAME pointing at the apex. So when the client checked that challenge name, DNS said “that’s an alias for example.com”. The client used by Traefik, lego, follows CNAMEs on the challenge name by default. That’s a feature: it lets you delegate challenges to another zone on purpose. Here it meant lego wrote the TXT record at the apex instead of where I wanted it.

On staging that happened to work, because I ran it before I’d added the *.lab record for my apps. By the time I tried production, that record existed, and the place lego wrote the proof and the place Let’s Encrypt looked for it no longer matched.

The fix

One environment variable for the client:

LEGO_DISABLE_CNAME_SUPPORT=true

With that set, lego writes the TXT record exactly at _acme-challenge.lab.example.com, ignoring the alias. The next production attempt issued a trusted certificate.

I put the variable into the service’s unit file, not only into the running container, so a redeploy can’t quietly take it away.

What I took from it

  • Wildcards at the top of a zone catch more than you think. They answer for names you never meant them to, including names your tooling invents, like _acme-challenge.
  • Staging is a test of your config, not of your DNS at the moment you go live. Anything that changes in between can make it a different test.
  • That old catch-all record is on my list to delete. It was doing nothing useful except this.

The challenge was never the hard part. Finding where my own DNS had sent it was.

Names and addresses are placeholders · first published November 2026