Create a proxied DNS record

Add an A record behind the Cloudflare proxy; with proxied=true, ttl must be 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"]}'

    Purge only selected files; avoid purge_everything in production, it empties the whole cache at once.

all 2 cloudflare commands