How do I configure Caddy to use a Cloudflare API token for automatic SSL certificate renewal?

Responsive Ad Header

Question

Grade: Education Subject: Support
How do I configure Caddy to use a Cloudflare API token for automatic SSL certificate renewal?
Asked by:
93 Viewed 93 Answers

Answer (93)

Best Answer
(416)
To use a Cloudflare API token for automatic SSL certificate renewal in Caddy, you need to include the `tls` directive in your Caddyfile. The configuration looks something like this: `tls { api_key YOUR_CLOUDFLARE_API_TOKEN }`. Replace `YOUR_CLOUDFLARE_API_TOKEN` with your actual Cloudflare API token. This allows Caddy to automatically request and renew SSL certificates from Cloudflare without manual intervention.