The web HTTP caching 2 min read
How does HTTP caching work?
A browser can reuse a cached copy instead of asking the server again. Should an invoice response be stored the same way as the site logo?
-
Look at who can reuse the copy
A private cache belongs to a single user context, such as a browser’s cache. A shared cache can serve different users. A public logo may be reusable across users. An invoice must stay within the access rules for that customer.
In short Ask who might receive the stored response.
-
Tell caches how to handle the invoice
The server can send
Cache-Control: no-storeto instruct HTTP caches to avoid storing that response. If browser storage is acceptable but shared caching is not,privateexpresses a different rule.In short Use no-store when the response should stay out of HTTP caches.
Where this applies
Cache-Control governs HTTP caches. It can’t stop someone from saving a file they already received.
Keep this
Choose a cache rule based on the response and its audience.
Review private responses separately from reusable public assets.