> ## Content Index
> Fetch the complete content index at: https://www.ctrl.blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# Which CDN providers support stale-while-revalidate?
- URL: https://www.ctrl.blog/entry/cdn-rfc5861-support/
- Published: 2017-10-19T04:58:00.000Z
- Updated: 2026-08-23T22:03:03.000Z
- Description: A quick review of which content delivery networks support RFC 5861’s Stale-While-Revalidate and Stale-If-Error caching directives.
- Author: Daniel Aleksandersen
- Tags: CDN, HTTP Caching, Hypertext

Last week, I talked about the benefits of and how you can [test for stale-while-revalidate support](https://www.ctrl.blog/entry/how-to-test-stale-while-revalidate/) (RFC 5861.) This week, I’ve done the testing for you.

The below table shows some content delivery networks (CDN) and to what degree they support RFC 5861\. The selection of CDNs included is skewed towards low-cost providers, and providers with a free trial period. I hope to expand the table in the future.

__RFC 5861 support on select content delivery networks__
| Provider         | stale-if-error | stale-while-revalidate | Using HTTP | Async | Documented |
| ---------------- | -------------- | ---------------------- | ---------- | ----- | ---------- |
| Azure CDN        | Supported      | Yes                    | No         | Yes   |            |
| BelugaCDN        | Unsupported    | No                     |            |       |            |
| BunnyCDN         |                |                        |            |       |            |
| CDN77            | Supported      | Yes                    |            |       |            |
| CDNSun           | Unsupported    |                        |            |       |            |
| Cloudflare       | Supported      | No                     | Yes        |       |            |
| Fastly           | Supported      |                        |            |       |            |
| KeyCDN           |                |                        |            |       |            |
| Google AMP Cache |                |                        |            |       |            |

**Update** (2020-11-23): Corrected table to reflect that Cloudflare does not support asynchronous background revalidation.

**Update** (2018-06-07): KeyCDN now supports asynchronous background revalidation.

### Why asynchronous revalidation?

Azure CDN, Cloudflare, and KeyCDN support `stale-if-error` and `stale-while-revalidate`, but they don’t support asynchronous background revalidation of expired cached items. This means that the first visitor to request an expired resource from the cache has to wait while it’s being updated at the cost of latency.

Subsequent requests to the same resource while another request is busy updating it gets served a stale copy from the cache. This isn’t RFC 5861 compliant and as such is marked in orange in the table as some visitors will experience higher latency than other visitors as compared to a fully asynchronous implementation.

I can’t explain this any better than RFC 5861 itself:

> “The `stale-while-revalidate` HTTP Cache-Control extension allows a cache to immediately return a stale response while it revalidates it in the background, thereby hiding latency (both in the network and on the server) from clients.”

All but one of the providers included in the above table use either Varnish Cache or Nginx. Neither servers support `stale-while-revalidate` out-of-the box; it has to be enabled in configuration. As [discussed last week](https://www.ctrl.blog/entry/how-to-test-stale-while-revalidate/), Nginx requires additional configuration to support asynchronous updates to the cache that only recently became available. The table would have looked very different just 10 months ago.

CDN providers that deploy Varnish Cache or Apache Traffic Server are more likely to have support for stale-while-revalidate with asynchronous updates. The feature have been available in the two servers since 2015 and 2014 respectively. Nginx only recently added support in February 2017.

### No documentation? No support?

The only two things that sets Fastly apart from BunnyCDN and KeyCDN is that Fastly runs on Varnish Cache rather than Nginx, and that Fastly have stated publicly that they support RFC 5861.

If there isn’t any official documentation about the feature from a CDN provider, you also don’t have any indication of a commitment from them that it will continue to be supported. If it stops working some time in the future, it’s also less likely that they’ll prioritize fixing it again. You may have a harder time reaching out to customer support if anything goes wrong.

**Update** (2020-02-05): BunnyCDN have since disabled support for RFC 5861\. Demonstrating my above point perfectly.

You should choose a CDN provider that has official documentation, or at the very least an official acknowledgment of the features your website relies upon. RFC 5861 is no exception to this rule of thumb, which is why I included this in information in the comparison table.

**Update** (2020-07-29): Cloudflare has been added to the table. It supports RFC 5861 even on its free tier, but only when the Origin Cache Control feature is enabled.

**Update** (2018-02-10): KeyCDN has been added to the table.

You can submit new CDN providers that are missing from the table using the below corrections link. I’ll review it and add it to the article. Please include any links to official documentation from the provider you wish to include.

#### Sources

- [Understanding Origin Cache-Control](https://developers.cloudflare.com/cache/concepts/cache-control/?ref=ctrl.blog), 2020-06-15, Caching, Support, Cloudflare
- My own tests conducted in September 2017.
- Email exchanges with Dejan Pelzel, founder of BunnyCDN.
- [KeyCDN Now Supports Stale-While-Revalidate & Stale-If-Error](https://www.keycdn.com/blog/keycdn-supports-stale-while-revalidate?ref=ctrl.blog), 2017-05-18, Cody Arsenault, KeyCDN Blog, KeyCDN
- [Google AMP Cache Overview](https://developers.google.com/amp/cache/overview?ref=ctrl.blog#google-amp-cache-updates), 2017-02-09, AMP on Google, Google Developers, Google
- [Azure CDN rules engine features](https://learn.microsoft.com/en-us/azure/cdn/cdn-verizon-premium-rules-engine-reference-features?ref=ctrl.blog), 2017-01-23, Richard Li and Cam Soper, Microsoft Azure Documentation, Microsoft
- [Changes in Varnish 4.1](https://github.com/varnish/Varnish-Cache/blob/b961b70cad/doc/sphinx/whats-new/changes.rst?ref=ctrl.blog), commit b961b70cad, 2015-09-30, Federico G. Schwindt and Lasse Karstensen, Varnish Cache project repository, Varnish Cache, GitHub
- [Stale-While-Revalidate in the core](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=56067381&ref=ctrl.blog), revision 56067381, 2015-04-29, Sudheer Vinukonda, Traffic Server wiki, Apache Software Foundation
- [Stale-While-Revalidate, Stale-If-Error Available Today](https://www.fastly.com/blog/stale-while-revalidate-stale-if-error-available-today?ref=ctrl.blog), 2014-09-18, Steve Souders, Fastly Blog, Fastly
- [RFC 5861 HTTP Cache-Control Extensions for Stale Content](https://www.rfc-editor.org/rfc/rfc5861.html?ref=ctrl.blog), 2010-05, Mark Nottingham, Yahoo! Inc., Internet Engineering Task Force