A Cloudflare Worker that updates DNS A records for gingerlycoding.com subdomains via the dyndns2 protocol. Designed for Ubiquiti Unifi gateways with WireGuard VPN that need stable hostnames despite dynamic residential IPs.
Configured via the ALLOWED_SUBDOMAINS environment variable (comma-separated). Currently:
pawnee.gingerlycoding.communcie.gingerlycoding.com
GET|POST|PUT https://dyndns.gingerlycoding.com/host/:id?ip=:ip
Where :id is pawnee or muncie and :ip is a valid IPv4 address.
Authentication: HTTP Basic Auth.
| Body | Meaning |
|---|---|
good <ip> |
DNS record updated |
nochg <ip> |
IP already matches, no change |
nohost |
Unknown hostname |
badauth |
Authentication failed (HTTP 401) |
badip |
Missing or invalid IP address |
911 |
Server error |
npm install
npm test # run tests
npm run dev # local dev server via wranglerTest with curl:
curl -u user:pass "http://localhost:8787/host/pawnee?ip=1.2.3.4"npm run deploySet via wrangler secret put <NAME>:
| Secret | Purpose |
|---|---|
CF_API_TOKEN |
Cloudflare API token with Zone > DNS > Edit + Read for gingerlycoding.com |
CF_ZONE_ID |
Zone ID for gingerlycoding.com |
BASIC_AUTH_USERNAME |
Basic auth username |
BASIC_AUTH_PASSWORD |
Basic auth password |
ALLOWED_SUBDOMAINS |
Comma-separated list of allowed subdomains (e.g. pawnee,muncie) |
Configure a custom DDNS provider on each gateway:
- Service: Custom
- Hostname:
pawnee(ormuncie) - Server:
dyndns.gingerlycoding.com/host/%h?ip=%i - Username: value of
BASIC_AUTH_USERNAME - Password: value of
BASIC_AUTH_PASSWORD
Stream live logs from the deployed worker:
npx wrangler tailTest the live endpoint:
curl -u user:pass "https://dyndns.gingerlycoding.com/host/pawnee?ip=1.2.3.4"Common responses to check for:
good <ip>— working correctly, DNS updatednochg <ip>— working correctly, IP already currentbadauth— checkBASIC_AUTH_USERNAME/BASIC_AUTH_PASSWORDsecretsnohost— the subdomain isn't inALLOWED_SUBDOMAINS, or the path format is wrong911— checkCF_API_TOKENpermissions andCF_ZONE_IDvalue vianpx wrangler tail