---
title: "What is stale-while-revalidate? Serve stale, refresh in the background — warmup.rocks Glossary"
description: "stale-while-revalidate lets caches serve an expired response immediately and refresh it in the background — visitors get cache speed even after expiry. Syntax, CDN support differences, and its limits."
canonical: https://warmup.rocks/glossary/stale-while-revalidate
---

# stale-while-revalidate

**stale-while-revalidate** (SWR) is a [Cache-Control](https://warmup.rocks/glossary/cache-control) extension (RFC 5861) that lets a cache serve an _expired_ response immediately while it fetches a fresh copy from the origin in the background. The visitor gets cache speed; the next visitor gets fresh content. It removes the worst moment in caching — the synchronous origin wait at expiry.

## Syntax

```
Cache-Control: max-age=600, stale-while-revalidate=120
```

Fresh for 10 minutes. For 2 minutes after that, the cache may still answer with the stale copy — but must kick off a background revalidation. Past the SWR window, the next request waits for the origin like a normal miss.

## Support is the fine print

-   **Browsers:** Chrome and Firefox honor it for HTTP cache entries.
-   **CDNs:** support varies more than most people assume. Fastly and bunny.net support it; Cloudflare's classic edge cache historically served stale only while updating in specific cases (`cf-cache-status: UPDATING`), and the [Workers Cache API ignores SWR entirely](https://warmup.rocks/blog/cloudflare-workers-cache-api) — we measured that on a production site.
-   **Related directive:** `stale-if-error` serves stale when the origin is down — different trigger, same spirit.

## What SWR doesn't fix

SWR only helps when there is a stale copy to serve. A cache that's simply _empty_ — after a [purge](https://warmup.rocks/glossary/cache-purge), a deploy, an [eviction](https://warmup.rocks/glossary/cache-eviction), or at an edge location that never saw the URL — has nothing stale to give, and the first visitor takes the full miss penalty (3.5× slower at the median, [in our measurement of 408,000 requests](https://warmup.rocks/blog/cdn-cache-miss-data)). SWR smooths expiry; [warming](https://warmup.rocks/blog/what-is-cache-warming) fills the gaps SWR can't reach. They compose well: long [s-maxage](https://warmup.rocks/glossary/s-maxage), a modest SWR window, and scheduled warming for the long tail.
