CDN Cache Purge Command Generator
Pick a CDN provider (Alibaba Cloud, Tencent Cloud, Cloudflare, AWS, Azure, or generic) and operation type, enter a URL list, and generate curl commands plus Python/Node.js/CLI code in one click — all credentials are placeholders and no request is ever actually sent.
FreeOnline Tool
Loading…
How to Use
- Choose the target CDN from the "Provider" dropdown: Alibaba Cloud CDN, Tencent Cloud CDN, Cloudflare, AWS CloudFront, Azure CDN, or a "Generic curl template".
- Choose the operation type: Purge URL, Purge Directory, Prefetch, or Purge All (some providers don't support certain operations — the tool flags this, e.g. Alibaba/Tencent Cloud don't support "Purge All").
- Enter the URLs to purge/prefetch in the textarea, one per line (use a path prefix for directory purges).
- Click "Generate Command" — the output box shows that provider's curl command, official CLI command (aliyun/tccli/aws/az), and Python/Node.js sample code, with all API keys/secrets/tokens shown as placeholders like YOUR_API_KEY.
- Click "Copy Output", replace the placeholders with your real credentials, and run it in your own terminal to actually trigger a cache purge. Click "Load Sample Data" for a quick preview (pre-filled with Cloudflare + Purge URL + 3 sample URLs).
Features
- Covers 5 CDN providers (Alibaba Cloud CDN, Tencent Cloud CDN, Cloudflare, AWS CloudFront, Azure CDN) plus a generic curl template — 6 targets in total.
- Supports 4 operation types: purge URL, purge directory/path, prefetch, and purge all, with provider-specific fallback notes when a capability isn't natively available (e.g. suggesting a curl loop to trigger origin fetches when CloudFront has no dedicated prefetch API).
- Generates a curl command per provider, plus the official CLI command (aliyun / tccli / aws cloudfront / az afd) and matching SDK sample code (mostly Python, with an additional Node.js example for Cloudflare).
- Every AccessKey/Secret/Token/ZoneID in the generated output is a fixed placeholder (e.g. YOUR_API_KEY, YOUR_ZONE_ID) — no real credentials you type anywhere else are ever read, sent, or stored.
- Includes a reference table of each provider's API endpoint, authentication method (HMAC signature, API Token, IAM signature, etc.), and daily quota, for cross-checking against official docs.
Use Cases
Batch-purging static asset caches after a release
After shipping new CSS/JS, a frontend engineer pastes the list of changed asset URLs and generates the matching CDN provider's purge command in one click, so users don't keep hitting stale cache.
Generating purge scripts across a multi-CDN setup
A team running both Alibaba Cloud and Cloudflare switches providers on the same URL list to generate both purge commands, avoiding the mental overhead of remembering each API's format.
Prefetching new images to avoid origin load spikes
After swapping the homepage banner, marketing ops uses "Prefetch" mode to generate a prefetch command that pushes the new asset to CDN edge nodes ahead of time, cutting down origin-fetch latency at launch.
Wiring a cache-purge step into a CI/CD pipeline
A DevOps engineer lightly adapts the generated Python/Node.js sample (swapping in real credentials from environment variables) to add an automated cache-purge step to the deployment pipeline.
FAQ
Will this tool actually purge my CDN cache using my API key?
No. It only generates command and code text in the browser — every credential field is a fixed placeholder (YOUR_API_KEY, YOUR_ZONE_ID, etc.) and no real credentials are read, sent, or stored. You need to replace the placeholders with your own keys and run the result in your own terminal or code for it to take effect.
Why don't some providers support "Purge All"?
Alibaba Cloud and Tencent Cloud CDN currently don't offer an API to wipe the entire site's cache in one call — their official docs require submitting URLs individually. When you select either provider with "Purge All", the tool flags this and suggests switching to "Purge URL" instead.
AWS CloudFront has no dedicated prefetch endpoint — how does the tool handle that?
It notes that CloudFront has no native prefetch API and instead generates a fallback script that curl-requests each URL in sequence to trigger an origin fetch (a manual form of prefetching), while suggesting CloudFront Functions/Lambda@Edge for a more robust solution.
Can I run the generated Python/Node.js code as-is?
The logic is complete and runnable, but you first need to install the matching SDK (boto3, requests, the Tencent/Alibaba Cloud SDK packages, etc.) and replace the placeholders with your real AccessKey/Secret/Token and resource IDs (ZoneID, DistributionId, etc.) before it can call the real API.
What's the difference between directory purge and URL purge?
URL purge targets one specific file. Directory purge (called path/prefix purge by some providers) clears the cache for every file under that path prefix — useful for batch scenarios, but with a much wider blast radius, so use it carefully.