Caddy 2 uses a new and improved DNS provider interface for solving the ACME DNS challenge.
All you have to do is plug the service provider(s) you need into your build, then add the DNS challenge to your configuration!
Getting a DNS provider plugin
How you choose to get a custom Caddy build is up to you; we’ll describe two common methods here.
Method 1:
- Go to the Caddy download page.
- Find your DNS provider in the list of modules (
dns.providers.*
) and select it. - Download your custom Caddy build.
Method 2:
- Find your DNS provider in the caddy-dns repositories.
- Build caddy with your DNS provider plugged in. This is a single
xcaddy
command:xcaddy build --with github.com/caddy-dns/REPOSITORY
If you do not find your DNS provider:
If you do not find a module for your DNS provider, that means nobody has implemented it yet. Your DNS provider must be implemented, either by you or someone else kind enough to do it. We can do it for your business for free with a Business+ sponsorship or higher.
Enabling the DNS challenge
Once you have a custom Caddy binary with your DNS provider module plugged in, you simply have to enable the DNS challenge in your config. Do this one of the following ways:
Caddyfile
Global option (use DNS challenge for all sites)
For a globally-recognized DNS challenge configuration, use the acme_dns
global option at the top of your Caddyfile:
{
acme_dns <provider> ...
}
For example:
{
acme_dns cloudflare 1484053787dJQB8vP1q0yc5ZEBnH6JGS4d3mBmvIeMrnnxFi3WtJdF
}
Per-site configuration
Or, to enable the DNS challenge for a specific site only, use a tls
directive in its site block:
tls {
dns <provider> ...
}
for example:
tls {
dns cloudflare 1484053787dJQB8vP1q0yc5ZEBnH6JGS4d3mBmvIeMrnnxFi3WtJdF
}
(You might also use a {env.*)
placeholder if your credentials are in the environment.) Each provider may have a slightly different syntax; check module docs to be sure.
JSON
Or, if you use JSON, configure an automation policy with an acme
issuer that sets the DNS challenge, for example:
{
"module": "acme",
"challenges": {
"dns": {
"provider": {
"name": "cloudflare",
"api_token": "YOUR_CLOUDFLARE_API_TOKEN"
}
}
}
}