Publicado en

Cache-Control Headers: Set Freshness for Public and Private Content

Public and private website content entering separate cache paths

Cache-Control headers tell HTTP caches how a response may be stored and reused. A sound policy distinguishes public pages, personal content, and versioned assets so that performance improvements do not serve stale or inappropriate data to visitors.

The words in a directive have specific meanings. In particular, no-cache does not mean no storage, and private does not mean encryption. CDNs can also apply explicit rules that affect origin headers, so inspect the behavior of the complete delivery path.

At getaboutcolumbia, this explanation turns common directives into practical content decisions and shows how to test freshness and separation between users.

Choose policy by content class

Start by listing the responses your website produces: public articles, asset files, search results, account pages, checkout steps, and administrative screens. A WordPress page cache policy should agree with that classification rather than treating all successful GET requests as equivalent.

The MDN Cache-Control reference defines no-cache as requiring validation before reuse, while no-store directs caches not to store the response. The private directive prohibits shared-cache storage while allowing a browser cache to store the response subject to other directives; max-age defines a freshness lifetime. Choose a clear policy from the actual requirement instead of appending every directive you have seen online.

A public article that tolerates a brief freshness window can use a policy appropriate to that editorial need. A customer account page requires careful private handling. A static asset whose filename changes with its contents can support a much longer lifetime because a new version has a new address.

For a hypothetical site, a logo file named with a content version can be cached aggressively, while a public announcement page needs rapid correction. These are different operational promises. The appropriate lifetime follows how the content changes and what stale information would mean to the visitor.

Do not rely on absence of a header as a private-content policy. The MDN HTTP caching overview explains that caches can make freshness decisions under defined rules. Explicitly state requirements where incorrect storage or reuse would be harmful.

Coordinate browsers, shared caches and validators

A browser cache belongs to an individual user agent, while a shared cache can serve multiple clients. IETF RFC 9111 defines HTTP cache behavior, including freshness and validation. Your configuration needs to identify which cache can reuse which response, not merely how long a file should stay somewhere.

Where appropriate, s-maxage can express a shared-cache lifetime separately from max-age. Confirm how your CDN interprets the origin policy and whether dashboard rules override it. Save the relevant rule and response headers with the configuration so a future operator can explain the observed result.

Validators such as ETag or Last-Modified can support checking whether a stored response is still current. A successful validation may allow reuse without transferring the entire body. Verify that validators change when the representation changes and that variants are handled consistently.

Your CDN invalidation workflow remains important for urgent updates. Changing today’s origin header does not magically retrieve copies that clients already consider fresh and are using without a network request. Versioned asset URLs help avoid that particular deployment problem.

Test anonymous and authenticated requests separately. Use two controlled test accounts with different harmless content and confirm that one account never receives another account’s response. Check login, logout, cookie changes, and any edge rules that vary the cache key.

Inspect the final public response after all proxies. The application, web server, hosting cache, and CDN may each add or alter headers. Multiple conflicting Cache-Control values are a signal to identify the owner of the policy, not to add one more plugin.

Consider response variants beyond authentication. Language, device-specific markup, accepted encoding, and selected currency can affect which response is appropriate. A cache key or Vary configuration must match genuine variations without creating unnecessary fragmentation.

Connect this work to hosting observability by recording cache hits, misses, bypasses, and errors for important routes. A falling hit ratio can reflect intentional private handling or an accidental cookie; the metric becomes useful only when you know the policy behind it.

Include error responses in the review. A temporary missing asset or service failure should not remain unexpectedly reusable after recovery. Inspect the status-specific behavior of your CDN and application, and choose an error freshness policy that matches how quickly those failures are expected to change.

Mistakes to avoid

Do not mark personalized content public simply because a performance audit suggests more caching. First establish that the same bytes are appropriate for every request that can share the key. Correctness takes precedence over a higher cache-hit figure.

Avoid applying a long lifetime to a frequently overwritten asset URL without a replacement strategy. Visitors can retain an older script or stylesheet after the server changes, creating mismatched application versions.

Two final recommendations

Write a short cache contract for each route class: eligible audience, freshness tolerance, invalidation trigger, and policy owner. That document makes configuration reviews much less ambiguous.

After a hosting, theme, or CDN change, repeat header and user-separation checks. A setting that worked previously may be overridden by a new layer even when the application code did not change.

Conclusion

Cache-Control headers are effective when they express clear freshness and storage requirements for each content class. Public reuse, private handling, and versioned assets need different decisions.

Choose directives deliberately, verify the headers visitors receive, and test authentication and representation variants through the full delivery chain.

Keep policy ownership and invalidation procedures together. A cache that is fast, predictable, and correct is more valuable than one that merely retains everything for longer.

Official sources consulted