Glossary · Performance

Stale-While-Revalidate

Stale-while-revalidate is a Cache-Control extension that serves a stale cached response immediately while fetching a fresh copy in the background.

Updated October 6, 2026

Stale-while-revalidate is a Cache-Control directive (RFC 5861) that lets a cache return an expired response instantly while it quietly requests an updated version for later requests. The next visitor then gets the fresh copy.

Why it matters

Normally an expired entry forces the user to wait for a full revalidation or download. With this directive the user never waits for the refresh, so latency stays low while content stays reasonably current. It suits content where being a few seconds or minutes old is acceptable, such as news lists, product catalogs or API data. Browsers and many CDNs support it, though implementations differ in detail.

Example

Cache-Control: max-age=60, stale-while-revalidate=300

For 60 seconds the response is fresh and served normally. From 60 to 360 seconds it is stale but may be served at once while a background request refreshes it. After 360 seconds the cache must wait for a fresh response. A related directive, stale-if-error, allows stale responses when the origin fails.

Common mistakes

  • Using it for personalized or sensitive pages.
  • Expecting instant accuracy; one user may still see old content.
  • Setting a very large window, so changes appear very late.
  • Assuming every CDN supports it identically. Test with headers.

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.