问题
RFC 5861 proposes the Cache-Control extensions stale-while-revalidate:
When present in an HTTP response, the stale-while-revalidate Cache- Control extension indicates that caches MAY serve the response in which it appears after it becomes stale, up to the indicated number of seconds.
and stale-if-error:
The stale-if-error Cache-Control extension indicates that when an error is encountered, a cached stale response MAY be used to satisfy the request, regardless of other freshness information.
to allow stale content to be used for longer when a response cannot be revalidated.
These are supported by CDNs, including Fastly and KeyCDN.
stale-while-revalidate
is also mentioned in the Fetch standard (stale-if-error
is not).
What is the state of support in browsers?
回答1:
As of May 2019, according to the compatibility tables of Mozilla and Chrome, stale-while-revalidate
is:
- supported in the beta releases of Firefox 68 (tracking)
- due to be supported in Chrome 75 (tracking)
These will be the main releases of those browsers on 2019-07-09 and 2019-06-09 respectively.
stale-if-error
doesn't appear to have current, or planned, support.
(See the RFC author's blog Chrome and Stale-While-Revalidate for more detail on why to implement this in browsers.)
来源:https://stackoverflow.com/questions/56196238/which-browsers-support-stale-if-error-and-stale-while-revalidate