Stale-if-error cache-control directive now supported for all responses
By Steven Van ·
Vercel's CDN can now serve a cached response instead of an error when the origin fails, for a duration set via stale-if-error.
Vercel's CDN now supports the stale-if-error Cache-Control directive. Setting it lets the CDN serve a previously cached response instead of an error when the origin fails, covering cases like a 500 Internal Server Error, a network failure, or a DNS error.
The directive takes a duration in seconds. For example, Cache-Control: max-age=604800, stale-if-error=86400 caches a successful response fresh for 7 days, then allows the stale copy to keep being served for up to 1 additional day if the origin is returning errors during revalidation. Once that extra window passes without a successful response, the CDN stops serving the stale copy and passes the origin's error through to users. See the announcement for details.