Why a certificate authority asks for proof
A TLS certificate states that a public key belongs to a domain. Before an authority signs that statement, it needs evidence that whoever asks for the certificate controls the domain. With ACME, the protocol Let's Encrypt and other authorities use, the evidence is a challenge: the authority hands your ACME client a random token, the client publishes it somewhere only the domain's owner could, and the authority looks for it.
The three challenge types differ only in where the token goes. That one difference decides which certificates you can get, where your client has to run, and whether anything in front of your site matters.
HTTP-01, TLS-ALPN-01 and DNS-01 compared
HTTP-01. The client serves a file at http://<domain>/.well-known/acme-challenge/<token> and the authority fetches it over port 80. It is the default in most clients and the easiest to start with. The domain must already point at a server that can serve the file, port 80 must be open, and it cannot issue wildcard certificates.
TLS-ALPN-01. The client answers a TLS connection on port 443 with a special certificate for the acme-tls/1 protocol. It suits setups that keep port 80 closed, needs control of the TLS listener itself, and cannot issue wildcards either.
DNS-01. The client publishes a TXT record at _acme-challenge.<domain> holding a value derived from the token, and the authority looks it up in DNS. Nothing on the web server is involved. It validates wildcards, works for hosts the internet cannot reach and works whatever sits in front of the site. In exchange, the client needs a way to write DNS records: an API, or your hands.
How DNS-01 works, step by step
1. Order. Your ACME client asks for a certificate covering, say, example.com and *.example.com.
2. Token. For each name the authority returns a DNS-01 challenge, and the client computes the value to publish from the token and its account key.
3. TXT record. The value goes into a TXT record named _acme-challenge.example.com. The wildcard uses the same name as the bare domain, so a certificate for both needs two TXT values under one name. That is normal: add both.
4. Propagation. The record has to reach every authoritative name server of the zone, because the authority may ask any of them, from several places.
5. Validation and issue. The client asks the authority to check; the authority finds the values, marks the names as validated, and the client downloads the certificate. The TXT records can then be removed.
You can see what the authority will see before asking it to look.
Check the TXT record before validation
# what your resolver sees
dig +short TXT _acme-challenge.example.com
# ask every authoritative name server directly
for ns in $(dig +short NS example.com); do
echo "$ns: $(dig +short TXT _acme-challenge.example.com @$ns)"
done
Wildcard certificates need DNS-01
A wildcard certificate covers every first-level name under a domain: *.example.com matches www.example.com, api.example.com and any subdomain you add next year, but not example.com itself and not a.b.example.com. That is why wildcard orders usually ask for example.com and *.example.com together.
Let's Encrypt validates wildcard names only with DNS-01, and the reason is simple: a file on one web server proves control of one hostname, while a wildcard speaks for every hostname in the zone, so the proof has to come from the zone itself.
Before a migration, behind a CDN, on private hosts
Because DNS-01 never touches the web server, it does not care where traffic goes.
Before a migration. Issue the certificate for the new platform while the domain still points at the old one. When you switch DNS, the certificate is already in place and HTTPS works from the first request.
Behind a CDN or a proxy. The validation does not depend on which server answers port 80, so the same client works whether the site is served directly or through a CDN.
Private and internal hosts. A staging server, an intranet application or a mail server that the internet cannot reach can still get a publicly trusted certificate, as long as its name sits in a public DNS zone you can write to.
Many servers, one name. Behind a load balancer, HTTP-01 has to find the token on whichever server answers. DNS-01 is validated once, and you distribute the certificate.
certbot, acme.sh and cert-manager
certbot supports DNS-01 in two ways. A DNS plugin writes and removes the TXT records through your DNS provider's API, which also makes unattended renewal possible; plugins exist for most large DNS providers and for RFC 2136 dynamic updates to your own name servers. Manual mode prints the record and waits for you to add it: fine for a one-off certificate, but every renewal needs a person.
acme.sh supports DNS-01 with well over a hundred provider APIs, and in Kubernetes cert-manager does the same through the dns01 solver of an Issuer. Whichever you use, keep the API credentials readable only by root and give the token the narrowest permission your provider offers, ideally editing DNS for one zone. The certbot guide covers installation, renewal and the HTTP-01 side.
certbot: a wildcard certificate with DNS-01
# with a DNS plugin (here: RFC 2136 dynamic updates to your own name server)
sudo certbot certonly \
--dns-rfc2136 --dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini \
-d example.com -d '*.example.com'
# manual: certbot prints the TXT values and waits for you
sudo certbot certonly --manual --preferred-challenges dns \
-d example.com -d '*.example.com'
# test renewal (works with a plugin; manual mode needs you again)
sudo certbot renew --dry-run
On cdn.com.tr: the edge certificate, ready before you switch DNS
When you move a live domain to cdn.com.tr, the panel issues the edge certificate with DNS-01 while the domain still points at your current provider. On the Domains tab of Domains & Rules, press Set certificate and choose Get a certificate before switching DNS. The wizard names the root domain and its wildcard, shows the TXT record to add at your current DNS provider, checks the record for you, and issues a Let's Encrypt wildcard certificate that is installed on the CDN servers automatically.
Switch DNS whenever you are ready: the domain is served over HTTPS from the first second, with no gap while a certificate is issued. The panel shows the certificate's expiry date, and running the wizard again takes the same few minutes. The DNS validation guide walks through every screen.
When DNS-01 is the right challenge
The certificate for the new platform exists before the first visitor arrives there.
One wildcard certificate for every first-level name, including the ones you add later.
Publicly trusted certificates for staging, intranet and mail servers the internet cannot reach.
How to set it up
Step-by-step guides in the help centre:
DNS-01 FAQ
What is the difference between HTTP-01 and DNS-01?
HTTP-01 proves control with a file served on port 80 of the domain; DNS-01 proves it with a TXT record in the domain's DNS. HTTP-01 needs the domain to point at the server asking for the certificate; DNS-01 works wherever the domain points and is the challenge that issues wildcard certificates.
Why are there two TXT records with the same name?
A certificate for example.com and *.example.com needs one validation per name, and both use _acme-challenge.example.com. Add both values as separate TXT records and keep them until validation finishes.
How long does propagation take?
Usually a few minutes, depending on your DNS provider and the record's TTL. Ask each authoritative name server with dig before you start validation; if one still answers without the new value, wait.
Does DNS-01 work behind a CDN?
Yes. The challenge is answered by your DNS, not by the server that answers web traffic, so it works the same with or without a CDN in front of the site.
Does a DNS-01 certificate renew automatically?
With a client that writes your DNS through an API, such as a certbot DNS plugin, acme.sh or cert-manager, yes. In manual mode someone adds the TXT record at every renewal, so plan for it or switch to an API.
Is it safe to give an ACME client access to my DNS?
Limit it. Create a token that can edit only the zone in question, or point _acme-challenge with a CNAME to a separate zone used only for validation, so the client cannot change anything else. Keep the credentials readable only by root.