Create API Key on Github
- My Profile
- API Tokens
- Create Token
- Edit zone DNS (Template)
- Change permissions from
EdittoRead(I tested this with Edit) - Add your domains/zones under
Zone Resource - Add your IPv(4/6) under
Client IP Adress Filtering - Click on
Continue to summary - Click on
Create Token - Copy your Key
Set SSL/TLS encryption mode to Full (strict)
Add your (Sub-)Domain record with enabled Proxy status
Add the following part into your Caddyfile for your (Sub-)Domain:
tls {
dns cloudflare <api_key>
}
// Credits: https://samjmck.com/en/blog/using-caddy-with-cloudflare/
or (for linux) set env value like this:
echo "export CLOUDFLARE_AUTH_TOKEN=TOKEN_HERE" >> ~/.bashrc
source ~/.bashrc
and you can use this in caddy:
tls {
dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
}
Download (and replace your currently binary file) a custom version on https://caddyserver.com/download with caddy-dns/cloudflare as feature.