Cache Control
HTTP DevAggressive Caching
|
|
- public - allows the content to be stored by any cache
- max-age=604800 - allows content to be cached for 7 days from the time the content was requested
- immutable - indicates the content will not chage over time
Aggressive Cache Prevention
|
|
- no-store - prevents the response from being stored in any cache
- max-age=0 - causes clients to clear existing cache-responses and forces re-validation
Directives no-cache vs no-store
There is a lot of confusion around no-cache and no-store. The no-cache directive allows the response to be stored in any cache. However the stored response must always go through validation with the origin server first.
Cache Validation
When cached content expires or revaliation is required because cache-control directives require it, the cache will forward a content request with an If-None-Match header to check if the content is fresh.
The asterisk means any resource and is only useful when uploading a resource to check if another resource with the identity has been uplaoded before.
Using this header makes the GET or HEAD request optional. These methods will return a 304 (Not Modified) response if the ETag matches.