Tier one: immutable hashed assets
JavaScript, CSS, and image files emitted by the Next.js build all have content-hashed filenames. They are safe to cache forever. Cache-Control: public, max-age=31536000, immutable. The immutable directive tells the browser not to revalidate even on reload, which saves a round trip. The MDN docs on Cache-Control and the RFC 9111 spec both cover the immutable semantics. Our pSEO images at images.alkenacode.dev share this configuration; effective cache-hit-rate at the Cloudflare edge stays above ninety-eight percent after the initial fill.
Tier two: HTML pages with revalidation
Static HTML for /p and /case-study routes uses Cache-Control: public, max-age=600, stale-while-revalidate=86400. Ten-minute cache, twenty-four-hour stale-while-revalidate. The browser serves cached HTML up to ten minutes old without any network call; from ten minutes to twenty-four hours it serves cached HTML and revalidates in the background. This balances freshness (a content edit goes live within ten minutes for fresh requests) against load (the origin sees roughly five percent of total traffic). The Cloudflare cache docs cover the SWR semantics.
Tier three: sitemap and robots, short cache
Sitemap.xml uses Cache-Control: public, max-age=3600. One-hour cache, no SWR. Search engine crawlers fetch the sitemap relatively often, but we want changes to propagate within the hour. Robots.txt uses the same configuration. Both files are tiny, so cache-revenue is small; the goal is freshness, not load reduction. The verify command is straightforward: curl -I against the asset and inspect the Cache-Control and CF-Cache-Status response headers; CF-Cache-Status: HIT confirms the edge is serving from cache.
