Cloudflare DDNS updating

1. The problem I’m having:

I am moving from Google Domains to Cloudflare. I’d like to use Caddy to update my wildcared dynamic DNS entry but can’t figure out the caddyfile syntax.

2. Error messages and/or full log output:

{"level":"info","ts":1707071955.3164907,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"warn","ts":1707071955.317363,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}
{"level":"info","ts":1707071955.3179402,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1707071955.3180556,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
{"level":"info","ts":1707071955.3180664,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"info","ts":1707071955.3181386,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0001d6e80"}
{"level":"info","ts":1707071955.3184648,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1707071955.318736,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1707071955.3191683,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1707071955.3192039,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["jellyfin.nagpal.house","calibre.nagpal.house","komga.nagpal.house","bitwarden.nagpal.house"]}
{"level":"warn","ts":1707071955.3204005,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"cff5af65-93ed-4056-be43-3c9c9ceabef7","try_again":1707158355.3203979,"try_again_in":86399.999999621}
{"level":"info","ts":1707071955.3206463,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1707071955.3246067,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1707071955.3246176,"msg":"serving initial configuration"}
{"level":"info","ts":1707072262.4420853,"msg":"shutting down apps, then terminating","signal":"SIGTERM"}
{"level":"warn","ts":1707072262.4421227,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
{"level":"info","ts":1707072262.4421406,"logger":"http","msg":"servers shutting down with eternal grace period"}
{"level":"info","ts":1707072262.4422655,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
{"level":"info","ts":1707072262.4422736,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
{"level":"info","ts":1707072262.7584531,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"warn","ts":1707072262.7589562,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":3}
{"level":"info","ts":1707072262.7592735,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1707072262.7593343,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
{"level":"info","ts":1707072262.7593405,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"info","ts":1707072262.7594118,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00004ab00"}
{"level":"info","ts":1707072262.7595108,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1707072262.7595665,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1707072262.7595813,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1707072262.7595832,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["bitwarden.nagpal.house","jellyfin.nagpal.house","calibre.nagpal.house","komga.nagpal.house"]}
{"level":"warn","ts":1707072262.7605994,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"cff5af65-93ed-4056-be43-3c9c9ceabef7","try_again":1707158662.7605984,"try_again_in":86399.999999799}
{"level":"info","ts":1707072262.7607706,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1707072262.763502,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1707072262.7635088,"msg":"serving initial configuration"}
{"level":"info","ts":1707075309.0337362,"msg":"shutting down apps, then terminating","signal":"SIGTERM"}
{"level":"warn","ts":1707075309.0337744,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
{"level":"info","ts":1707075309.033807,"logger":"http","msg":"servers shutting down with eternal grace period"}
{"level":"info","ts":1707075309.0339038,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
{"level":"info","ts":1707075309.0339143,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
{"level":"info","ts":1707075309.3472044,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
Error: adapting config using caddyfile: /etc/caddy/Caddyfile:2: unrecognized directive: provider
{"level":"info","ts":1707075363.053921,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
Error: adapting config using caddyfile: /etc/caddy/Caddyfile:2: unrecognized directive: dns_provider

3. Caddy version:

2.7.6

4. How I installed and ran Caddy:

Unriad Docker

a. System environment:

Unraid Docker

b. Command:

docker run
  -d
  --name='CaddyV2'
  --net='bridge'
  -e TZ="America/Los_Angeles"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Tower"
  -e HOST_CONTAINERNAME="CaddyV2"
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.icon='https://d1q6f0aelx0por.cloudfront.net/product-logos/library-caddy-logo.png'
  -p '180:80/tcp'
  -p '1443:443/tcp'
  -v '/mnt/user/appdata/caddy/data':'/data':'rw'
  -v '/mnt/user/appdata/caddy':'/config':'rw'
  -v '/mnt/user/appdata/caddy/Caddyfile':'/etc/caddy/Caddyfile':'rw' 'caddy:alpine'
a50e75a3c39c9c66532c529f2d042488280b36f22b1dc2c9ae061f42eb6c1962

d. My complete Caddy config:

dynamic_dns {
        dns_provider cloudflare
        api_token redacted
        domains {
                nagpal.house *
        }
        versions ipv4
        ip_source simple_http https://icanhazip.com
        ip_source simple_http https://api64.ipify.org
        check_interval 5m
}

calibre.nagpal.house {
        reverse_proxy 10.0.0.152:8083
        }

jellyfin.nagpal.house {
        reverse_proxy 10.0.0.141:8096
        }

komga.nagpal.house {
        reverse_proxy 10.0.0.101:25600
        }

dynamic_dns goes in the global options block. You must wrap it with { } braces as per the structure: