OOmnistu

Blog / Engineering Playbooks

Engineering Playbooks

HTTP caching for business sites: what to cache, what never to share

Understand HTTP caching controls and distinguish reusable public responses from private content that must not be shared.

OOmnistu
Reviewed 2026-11-16 · 3 min read

Caching makes sites faster and cheaper to run, and set up wrongly it can show one customer another customer's page. MDN's guide to HTTP caching (https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching) explains how it works. This article picks the parts a site owner should understand.

Why cache

MDN says a cache stores a response and reuses it for later requests. The closer the cache is to the client, the faster the response. When a response is reused, the origin server does not need to process the request, such as parsing it, restoring a session from a cookie, querying a database or rendering a template, which reduces server load.

Private vs shared caches

MDN's warning: if personalized content is stored somewhere other than a private cache, other users may be able to get it, which can leak information. To keep a personalized response in the private cache only, send Cache-Control: private. MDN adds that personalization is usually controlled by cookies but the presence of a cookie does not make a response private.

Fresh and stale

A stored response is fresh while its age is within its allowed lifetime and stale after. Age is the time since the response was generated, much like a time-to-live in other caches.

no-cache and no-store are different

MDN says no-cache does not prevent storing a response; it prevents reusing it without revalidation. If you do not want a response stored in any cache, use no-store. Also verify CDN and service-worker configuration: managed caches can use their own storage rules and may not follow that header automatically. MDN also notes that in practice "do not cache" usually covers three situations: privacy, always-fresh content and uncertainty about old implementations, and that no-store is not always the best choice for all of them.

Defaults and cache busting

MDN says a response without Cache-Control is not simply "not cached": browsers may apply heuristic caching. To avoid that, it prefers giving every response an explicit default Cache-Control. A common default to always get the latest version is no-cache, and for sites with logins or personalized content, add private: Cache-Control: no-cache, private.

For files that change, such as scripts and stylesheets, MDN describes cache busting: change the URL whenever the content changes (a version or content hash in the file name or query), so each URL can be cached for a long time safely.

A checklist for your developer

Content Suggested handling (our reading of the guide)
Pages with account or cart details private, and consider no-cache or no-store
Public HTML pages Explicit Cache-Control; decide freshness deliberately
Scripts and styles with version/hash in file name Long cache lifetime
Anything without explicit headers Check what heuristic caching does

Limits

We make no performance claims. We did not read MDN's sections on validation, Vary, request collapsing or deletion in detail. Test caching rules in a staging environment with two different accounts before going live.

By Omnistu.

Sources

Previous
Forgot-password security: design the whole reset flow