1001Ferramentas
⚠️ Security

Cache-Control Security Check

Analyse Cache-Control and warn when sensitive content may be cached by proxies (missing no-store, private, etc.).

Cache-Control on an authenticated page

A response carrying session data left in a cache is a classic leak: a statement sits in the browser cache of a shared computer, or worse, an intermediate proxy serves one user's page to another. The Cache-Control header is what prevents that, and the difference between directives that look equivalent is exactly where most people get it wrong.

Enter the header and tick whether the response carries a cookie or requires authentication, and the page points out what is loose. The distinction that matters most is between the directive forbidding storage and the one demanding revalidation: the first prevents storing at all; the second allows storing and merely requires checking before reuse — and checking against a server that is down, or with an already-expired session, can hand back the stored copy.

For authenticated content, the usual combination forbids storage and marks the response private, which blocks shared caches. Remember that browsers treat the back button specially: without the explicit prohibition, the page can reappear from memory even after logout. And that omitting the header does not mean no caching — it means letting the browser decide by heuristic, which tends to be generous.

Frequently asked questions

What is the difference between forbidding storage and requiring revalidation?
Forbidding means the response may not be written anywhere. Requiring revalidation allows writing it and obliges asking the server before reuse. For sensitive data the prohibition is correct — revalidation still leaves the content on disk, within reach of anyone with access to the machine.
What does the private directive do?
It authorises the browser cache and forbids shared caches, such as a proxy or a CDN. It is the minimum for any personalised response. It does not replace forbidding storage when the data is sensitive, because the content still lands on the client's disk.
Why does the page come back after logout?
Because browser history has rules of its own and can restore from memory without consulting the server. Explicitly forbidding storage prevents it, and invalidating the session server-side ensures that any redisplay grants access to nothing.

Related Tools