Skip to content

Caddy DNS Cloudflare

Maintained
caddy-dns/cloudflare

Caddy module for managing DNS records with Cloudflare

View on GitHub
Stars
1k
Forks
121
Watchers
1k
Open issues
13

Caddy DNS Cloudflare is a DNS provider module for Caddy that enables automatic DNS record management with Cloudflare. It’s particularly useful for automating SSL certificate management through ACME DNS challenges.

Key Features

  • Automatic DNS record management for Cloudflare
  • Support for ACME DNS challenges
  • Flexible authentication options
  • Secure API token management
  • Easy integration with Caddy server

Configuration Options

This module provides two ways to configure API tokens:

  1. Separate Zone and DNS Tokens

    • Zone Token: Zone.Zone:Read permission for All zones
    • DNS Token: Zone.DNS:Edit permission for specific domains
  2. Single API Token

    • API Token: Zone.Zone:Read and Zone.DNS:Edit permissions for All zones

Quick Start

JSON Configuration

{
    "module": "acme",
    "challenges": {
        "dns": {
            "provider": {
                "name": "cloudflare",
                "api_token": "{env.CF_API_TOKEN}"
            }
        }
    }
}

Caddyfile Configuration

Using Dual Keys

tls {
    dns cloudflare {
        zone_token {env.CF_ZONE_TOKEN}
        api_token {env.CF_API_TOKEN}
    }
}

Using Single Key

tls {
    dns cloudflare {env.CF_API_TOKEN}
}

Troubleshooting

Common Issues

  1. Invalid request headers

    • Ensure your API token is properly set in the environment variables
    • Verify the token has the correct permissions
  2. DNS propagation timeout

    • Check if the _acme-challenge TXT record is created in Cloudflare
    • Consider using Cloudflare’s DNS resolver (1.1.1.1)
    {
        "resolvers": ["1.1.1.1"]
    }

Documentation

For more detailed information, please refer to the Caddy Documentation.

Contributing

Contributions are welcome! Please ensure:

  1. Code follows Go standard formatting
  2. Tests are added for new features
  3. Documentation is updated accordingly

License

This project is licensed under the Apache License 2.0.

Similar open-source projects, ranked by shared categories and tags.

All DevOps projects →