A Cloudflare Worker that can act as a self-hosted Dynamic DNS (DDNS) provider for routers and clients that support custom DDNS update URLs. It implements a DynDNS-compatible update endpoint and updates DNS records in Cloudflare directly.
/nic/updatehostname parametermyip parameter for the public IP addressmyip is omittedA vs AAAA records based on the supplied IP addressgood, nochg, badauth, nohost, and dnserrWhen the worker receives a request to /nic/update, it:
hostname and optional myip query parameters.myip is missing, it tries to infer the client IP from the request headers (CF-Connecting-IP or X-Forwarded-For).The worker expects a request similar to:
curl -u "your-username:your-password" \
"https://your-worker.example.com/nic/update?hostname=home.example.com&myip=203.0.113.10"
hostname (required): the DNS name to updatemyip (optional): the IP address to setIf myip is omitted, the worker will try to detect it automatically from the incoming request.
The worker returns plain text responses with a trailing newline:
good <ip>: record updated successfullynochg <ip>: the record already had the requested valuebadauth: authentication failednohost: the hostname was missing or no matching DNS record was founddnserr: an internal DNS update error occurredCF_API_TOKEN: the API token created in step 1CF_ZONE_ID: the Cloudflare zone ID for the DNS zoneDDNS_USERNAME: the username to use for Basic AuthDDNS_PASSWORD: the password to use for Basic Authcurl -u "ddns-user:super-secret-password" \
"https://ddns.example.com/nic/update?hostname=router.example.com"
If the request comes from a client that exposes its IP address correctly, the worker will update the Cloudflare record automatically.
/nic/update path is supported. Other paths return 404.proxied: false and automatic TTL.A or AAAA record matching the IP type; otherwise it uses the first matching result.