Automating Wildcard SSL with Caddy and RFC 2136
Leverage Caddy's industry-leading Automatic HTTPS engine with the caddy-dns/rfc2136 plugin. Issue wildcard certificates and manage TLS lifecycles with just a few lines in your Caddyfile.
📋 Prerequisites
- An active domain on OnlyDNS.
- A TSIG Key generated in the OnlyDNS Portal or via CLI (
onlydns tsig create --algo hmac-sha256). - Caddy v2.x with the RFC 2136 plugin or Docker.
Obtain Caddy with the RFC 2136 Plugin
Caddy requires the caddy-dns/rfc2136 module to execute DNS-01 challenges. You can build it locally with xcaddy, download it from the Caddy website, or use a multi-stage Docker build:
Configure your Caddyfile
In your Caddyfile, specify your wildcard and apex domains with the tls directive and dns rfc2136 block:
key {env.ONLYDNS_TSIG_SECRET}.
_acme_challenge subdomain so Caddy cannot modify other zone records.
Start Caddy & Verify TLS
Start or reload Caddy. Caddy will detect that a wildcard domain is requested, dynamically post the ACME DNS-01 challenge TXT records to OnlyDNS, obtain the certificate, and maintain automated renewals in the background: