SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Caching 10 errors

Caching & CDN Errors

Cache stampedes, stale content, Varnish and CloudFront failures.

Understanding Caching errors

Cache problems are rarely reported as cache problems. They arrive as a traffic spike that takes down the origin (a stampede after a mass eviction), users seeing old content after a deploy, or an inexplicable 403 from the CDN. The unifying diagnostic is to look at the cache status header on a real response before theorising about anything else.

How to debug Caching errors

  1. Read the cache status header on a live request: curl -sI https://example.com | grep -i -E 'cache|age|x-cache|cf-cache-status'. HIT, MISS and BYPASS each point at a different root cause.
  2. Check the Age header against your intended TTL. An Age larger than max-age means something is serving stale content deliberately (stale-while-revalidate), often the desired behaviour, occasionally the bug.
  3. For stampedes, add request coalescing or a short randomised TTL jitter rather than a longer TTL. Identical expiry times across many keys are what create the thundering herd.
  4. Use content-hashed filenames for static assets and no-cache for HTML. Almost every "users see the old version" incident traces back to a long TTL on an HTML document.
  5. For CDN 403s, distinguish a CDN-generated response from an origin one by checking whether CDN-specific headers are present. An origin 403 has a completely different fix.

Tools worth reaching for

  • curl -sI
  • varnishlog
  • CDN edge logs
  • Cache-Control validators

All 10 Caching errors

Other categories