Glossary · Performance

stale-if-error

stale-if-error is a Cache-Control extension that lets a cache serve an expired response when the origin returns an error, instead of passing the error on.

Updated October 21, 2026

stale-if-error is a Cache-Control directive defined in RFC 5861. It allows a cache to keep using a stale (expired) stored response for a stated number of seconds if the origin fails, for example with a 5xx error or a connection failure.

Why it matters

It turns a short origin outage into something visitors may not notice. A cached article page can keep appearing for minutes or hours while the application is down or being repaired. It pairs naturally with stale-while-revalidate, which hides refresh latency. Support varies by cache, so check the current docs of your CDN or reverse proxy before relying on it.

Example

Cache-Control: max-age=600, stale-while-revalidate=60, stale-if-error=86400

The response is fresh for 10 minutes. After that, a supporting cache can refresh in the background for 60 seconds while serving the stale copy. If the origin is erroring, it may keep serving the old copy for up to 24 hours.

Common mistakes

  • Using it on personalized or private pages. Never serve stale user-specific data.
  • Assuming every CDN honors it. Some use their own settings.
  • Forgetting that monitors then see healthy 200 responses while the origin is actually down, so monitor the origin directly too.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.