Cache purging removes cached content from Sudun edge servers, forcing fresh content to be fetched from your origin. This guide covers purge methods, best practices, and automation options.
Common scenarios requiring cache purge:
| Scenario | Purge Type | Example |
|---|---|---|
| Content update | Single URL | Updated blog post |
| Site redesign | Purge everything | New CSS/JS deployed |
| Emergency fix | URL or tag | Security patch |
| Asset version change | Prefix purge | /assets/v2/* |
Remove specific URLs from cache:
https://example.com/blog/post-1
https://example.com/images/hero.jpg
https://example.com/css/styles.css
Best for: Individual content updates, targeted cache clearing
Remove all URLs matching a path prefix:
https://example.com/blog/*
https://example.com/images/*
https://example.com/api/v1/*
Best for: Section updates, versioned asset deployments
Remove content by associated tags:
Tags: product-123, category-electronics, homepage
Best for: Dynamic content relationships, CMS integrations
Remove all cached content for a domain:
Domain: example.com
Action: Purge All
Warning: Purging everything causes a surge of requests to your origin. Use sparingly and preferably during low-traffic periods.
https://example.com/blog/)Cache tags allow content-based purging without knowing exact URLs.
Add tags via response headers from your origin:
Cache-Tag: product-123, category-shoes, homepage
Or configure in Sudun:
{
"cache_tags": {
"rules": [
{
"match": { "path": "/products/*" },
"tags": ["products", "catalog"]
},
{
"match": { "path": "/blog/*" },
"tags": ["blog", "content"]
}
]
}
}
# Purge all content with tag "product-123"
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tags": ["product-123"]}'
| Tag Type | Example | Use Case |
|---|---|---|
| Entity ID | product-123 | Purge when product updates |
| Category | category-electronics | Purge category pages |
| Content type | blog-posts | Purge all blog content |
| Template | template-homepage | Purge after template change |
After initiating a purge:
Purge Request → Sudun API → Global PoPs
│
┌───────┴───────┐
│ │
~1-5 seconds ~30 seconds
(most PoPs) (all PoPs)
| Purge Type | Typical Propagation |
|---|---|
| Single URL | 1-5 seconds |
| Prefix | 5-15 seconds |
| Cache Tag | 5-15 seconds |
| Everything | 15-60 seconds |
Immediately removes content from cache:
Cache State: MISS
Origin Request: Required
Marks content as stale but keeps it available:
Cache State: STALE
Origin Request: Background revalidation
Benefits of Soft Purge:
# Soft purge via API
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"urls": ["https://example.com/page"], "soft": true}'
Trigger purge from your CMS or deployment pipeline:
# WordPress example: purge on post update
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"tags": ["post-${POST_ID}"]}'
Purge after deployment:
# GitHub Actions example
- name: Purge CDN Cache
run: |
curl -X POST https://api.Sudun.com/v1/domains/$DOMAIN/purge \
-H "Authorization: Bearer $YESudunPI_KEY" \
-d '{"prefix": "https://$DOMAIN/assets/"}'
Set up automatic purge schedules:
- Frequency: Daily, Weekly, Custom
- Time: Choose off-peak hours
- Purge Type: Prefix or Tag
Purge operations have rate limits to protect the system:
| Plan | URL Purges/min | Prefix Purges/hr | Everything/day |
|---|---|---|---|
| Starter | 100 | 10 | 5 |
| Business | 1,000 | 50 | 20 |
| Enterprise | 10,000 | 500 | Unlimited |
View purge history in the dashboard:
- Timestamp
- Purge type
- URLs/Tags affected
- Propagation status
- Initiated by (user or API)
```
Cached: https://example.com/page?v=1
Purge: https://example.com/page ← Won't match!
```
Query string variations: If caching includes query strings, purge all variations
Browser cache: Clear browser cache or use incognito mode
Propagation delay: Wait 30-60 seconds for global propagation
| Error | Cause | Solution |
|---|---|---|
| 401 Unauthorized | Invalid API key | Check API credentials |
| 403 Forbidden | Insufficient permissions | Verify account access |
| 429 Too Many Requests | Rate limit exceeded | Wait and retry |
| 400 Bad Request | Invalid URL format | Check URL syntax |
If your origin struggles after a full purge:
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": [
"https://example.com/page1",
"https://example.com/page2"
]
}'
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"prefix": "https://example.com/blog/"}'
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"tags": ["product-123", "homepage"]}'
curl -X POST https://api.Sudun.com/v1/domains/example.com/purge \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"purge_everything": true}'
Need help with cache purging? Contact support@Sudun.com