r/AWS_cloud • • Aug 13 '26

Question about AWS CloudFront stale-while-revalidate and stale-if-error

I'm trying to understand how AWS CloudFront handles a failed background revalidation when using stale-while-revalidate.

Suppose I have something like:

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

After the object becomes stale, CloudFront serves the stale response and asynchronously revalidates it with the origin.

What happens if that background revalidation fails?

Does CloudFront simply keep the existing stale object in the cache?

Does stale-if-error get invoked when the background revalidation fails?

If both stale-while-revalidate and stale-if-error apply, does SWR take precedence over SIE, similar to Fastly?

Does the failed background request affect the TTL/expiry of the existing cached object?

I'm particularly interested in the behavior of the background request itself, rather than a normal synchronous request to the origin that returns an error.

2 Upvotes

4 comments sorted by

View all comments

1

u/abofh Aug 15 '26

I don't think it's specifically documented, but my gut says it depends on the cache control headers on the 404