Introduction When CDN cache does not update after content changes, users see outdated content. This is especially problematic after deployments, content updates, or emergency fixes.
Symptoms - Updated files not visible through CDN after deployment - Purge request returns success but content still stale - Different CDN edge locations showing different content - Cache-Control headers being ignored - Origin shows new content but CDN shows old
Common Causes - Cache-Control max-age too long - CDN not respecting purge requests - Origin shield caching stale content - Purge not propagated to all edge locations - Versioned URLs not updated in application
Step-by-Step Fix 1. **Verify origin has correct content': ```bash curl -I http://origin.example.com/file.css # Check Last-Modified and ETag ```
- 1.**Purge CDN cache':
- 2.```bash
- 3.# CloudFront
- 4.aws cloudfront create-invalidation --distribution-id E123 --paths "/*"
- 5.# Fastly
- 6.curl -X PURGE https://api.fastly.com/service/<id>/purge_all
- 7.# Cloudflare
- 8.curl -X POST https://api.cloudflare.com/client/v4/zones/<id>/purge_cache \
- 9.-H "Authorization: Bearer <token>" \
- 10.-H "Content-Type: application/json" \
- 11.-d '{"purge_everything":true}'
- 12.
` - 13.**Check cache headers on origin':
- 14.```bash
- 15.curl -I https://cdn.example.com/file.css
- 16.# Look for: Cache-Control, Age, X-Cache
- 17.
`