Create proxied DNS record

Add A record behind CF proxy; proxied=true requires ttl=1 (auto)

curl -sX POST "https://api.cloudflare.com/client/v4/zones/<id>/dns_records" -H "Authorization: Bearer $CF_TOKEN" -H 'Content-Type: application/json' --data '{"type":"A","name":"<host>","content":"<ip>","proxied":true,"ttl":1}'

tool
cloudflare2 commands
tags
cloudflarednsnetworkcloud

More cloudflare commands

  • curl -sX POST "https://api.cloudflare.com/client/v4/zones/<id>/purge_cache" -H "Authorization: Bearer $CF_TOKEN" -H 'Content-Type: application/json' --data '{"files":["https://<host>/app.js"]}'

    Selective purge by file; note: purge_everything thrashes cache, avoid in prod

all 2 cloudflare commands