Skip to content

Instantly share code, notes, and snippets.

@tuannvm
Last active May 16, 2019 08:59
Show Gist options
  • Save tuannvm/d5030b1c0bbeb57245ea310031e2cc31 to your computer and use it in GitHub Desktop.
Save tuannvm/d5030b1c0bbeb57245ea310031e2cc31 to your computer and use it in GitHub Desktop.
#cloudflare #cache #script
#!/bin/bash
commit_url="https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache"
data=$(cat <<EOF
{
"files":["$CF_HOST"]
}
EOF
)
curl -XPOST "$commit_url" -d "$data" \
-H "X-Auth-Email: $CF_EMAIL" \
-H "X-Auth-Key: $CF_API_KEY" \
-H "Content-Type: application/json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment