Use stored success after an eligible error
03stale-if-error can allow a cache to return stored content instead of an eligible failure, within a separate staleness limit.
300 seconds stale is within the 1200-second allowance. Return stored success with Age: 900, not a new origin response.
Source for this drawing: RFC 5861 · Read RFC section 4 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
- stale-if-error
- Permission to use a stale response after an eligible error, within its stated limit.
- Response versus request scope
- A response directive can apply to future matching requests; a request directive applies only to that request.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
RFC 5861 and verified editorial errata 2255/2256 mention Age and Warning fields. Current HTTP caching obsoletes Warning; Age and other fields convey cache state. The example retains Age: 900 without presenting Warning as a current requirement. This is related HTTP context, not an update or obsoletion of RFC 5861.
Read the updated RFC section ↗An error permits a fallback; it does not turn the stored response fresh.
- stale-if-error=1200 indicates that a stale cached response MAY satisfy a request when an eligible error occurs, up to 1200 seconds of staleness. Here error means a situation that would return 500, 502, 503 or 504, not every status such as 404.
- The directive can appear on a request, scoped to that request, or on a response, scoped to any applicable request for that cached response. It is independent of stale-while-revalidate; neither directive requires the other.
- The RFC’s example has max-age=600 and stale-if-error=1200. At Age 900, staleness is 300 seconds: after an origin 500, this cache chooses a stored 200 success with Age: 900. It does not rewrite that response as fresh or pretend the origin returned a new 200.
The illustration follows the RFC’s successful-response/error-response example. Cache to origin validation occurs before the fallback decision; the origin’s 500 reaches the cache, then the cache returns its old success to the client. Preserve estimated age and current HTTP cache restrictions. RFC 5861’s visible-staleness language historically mentions Age and Warning; verified editorial errata 2255/2256 correct the field terminology.
Read the RFC section ↗