Often I use
Cache-Control: no-cache
or
Cache-Control: max-age=0
The spec says must-revalidate
is for max-stale
... (the server issue max-stale
?)
So if for normal web servers, Apache, or Rails with Mongrels, then I think usually there is no max-stale
, so must-revalidate
is not needed?
The must-revalidate directive ought to be used by servers if and only if failure to validate a request on the representation could result in incorrect operation, such as a silently unexecuted financial transaction.
The must-revalidate response directive indicates that the response can be stored in caches and can be reused while fresh. If the response becomes stale, it must be validated with the origin server before reuse. Typically, must-revalidate is used with max-age .
Without the cache control header the browser requests the resource every time it loads a new(?) page.
Revalidation checks occur when a browser sends a request to a cache server using If-Modified-Since or If-None-Match headers. These request headers are questions sent from the browser cache about when an object has last changed that can be answered via the ETag or Last-Modified response headers on the cache server.
must-revalidate
should be specified by servers where it would be incorrect (and not just suboptimal) for a client to get a stale response. This applies to all requests with max-stale
as you mentioned. It also applies, if a cache temporarily loses connectivity to the origin (a cache is allowed to return a stale entry with a Warning
header in this case). That being said, I think you are right that this directive is not needed particularly in practice; it's seen most often in a situation where the origin wants to let a client cache a copy of the resource (for bandwidth conservation purposes) but always validate it before use, as in:
Cache-Control: private, max-age=0, must-revalidate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With