You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply stale-while-revalidate also for responses without a validator
Due to its name, the stale-while-revalidate Cache-Control extension
might suggest that it only applies to revalidation requests. However,
looking at https://tools.ietf.org/html/rfc5861#section-3...
> The stale-while-revalidate Cache-Control Extension
> 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.
> stale-while-revalidate = "stale-while-revalidate" "=" delta-seconds
> If a cached response is served stale due to the presence of this
> extension, the cache SHOULD attempt to revalidate it while still
> serving stale responses (i.e., without blocking).
There is no reason why a cache should not also return a stale response
while a complete re-fetch happens in the background (just what would
happen if validation fails).
This makes a difference if, for example, a resource has
`Cache-Control: public, max-age=30, stale-while-revalidate=30` set and
no additional Last-Modified or ETag headers.
Co-Authored-By: Philip Hofstetter <phofstetter@sensational.ch
0 commit comments