HTTP Standard
Caching
Forcing Revalidation of Cached Responses
Despite having "must" in its name,
Cache-Control: must-revalidate
only revalidates
(i.e. sends If-Modified-Since
or
If-None-Match
) after
the content has expired (emphasis added):
When the must-revalidate directive is present in a response received by a cache, that cache MUST NOT use the entry after it becomes stale to respond to a subsequent request without first revalidating it with the origin server.
To force always revalidating, use the oddly named
Cache-Control: no-cache
which does
cache and always revalidates (emphasis added; and
with what seems like a gratuitous double negative in an already
confusing section):
If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server.
In more direct terms from MDN (emphasis added):
- must-revalidate: Indicates that once a resource becomes stale, caches must not use their stale copy without successful validation on the origin server.
- no-cache: The response may be stored by any cache, even if the response is normally non-cacheable. However, the stored response MUST always go through validation with the origin server first before using it
If content is not often changing, then such revalidations should
usually return 304 Not Modified
to re-use the previously
cached response.