|
|
|
|
|
by endymi0n
1778 days ago
|
|
And to add the last big one from the trifecta: Know how to deal with cacheable data. Know how to deal with uncacheable data. But by all means, know how to keep them apart. Accidentally caching uncacheable data has lead so some of the most ugly and avoidable data leaks and compromises in recent times. If you go down the "route everything through a CDN route (that can be as easy as ticking a box in the Google Cloud Platform backend), make extra sure to flag authenticated data as cache-control: private / no-cache. |
|
no-cache means that the response may be stored in any cache, but cached content MUST be revalidated before use.
public means that the response may be cached in any cache even if the response was not normally cacheable, while private restricts this to only the user agent's cache.
no-store specifies that this response must not be stored in any cache. Note that this does not invalidate previous cached responses from being used.
max-age=0 can added to no-store to also invalidate old cached responses should one have accidentally sent a cacheable response for this resource. No other directives have any effect when using no-store.