AFD Premium - Caching - stale-while-revalidate or similar capability

Jack Jin MSFT Accenture 80 Reputation points Microsoft Vendor
2024-04-15T19:16:28.71+00:00

Hello!

We're looking to configure our caching so that we're optimizing the end user experience and serve up fresh content frequently.

Nice to have requirement: Closer to 99% traffic served from CDN cache, even when cache is has expired.

When cache expires after a short time say 5 minutes, and a request comes in 5:05, 5 seconds after the cache expired, the CDN would serve up the previously cached content (cached 5:05 ago) and do a background behind the scene fetch to origin and retrieve updates. So the next request comes in at 5:15 would get the new content.

Ideally Azure Front Door would honor something similar to stale-while-revalidate documented on https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#use_cases. Where I can configure max-age to something relatively short (300 seconds) and stale-while-revalidate to something longer (3600 seconds).

Linking a Fastly example here - https://www.fastly.com/documentation/guides/concepts/edge-state/cache/stale/

AWS CloudFront - https://aws.amazon.com/about-aws/whats-new/2023/05/amazon-cloudfront-stale-while-revalidate-stale-if-error-cache-control-directives/

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
580 questions
0 comments No comments
{count} votes

Accepted answer
  1. ChaitanyaNaykodi-MSFT 23,031 Reputation points Microsoft Employee
    2024-04-15T22:28:47.7266667+00:00

    @Jack Jin MSFT Accenture

    Thank you for reaching out.

    I understand you wish to know if Azure Front Door would honor something similar to stale-while-revalidate.

    Not sure if you have gone through the documentation here Azure Front Door has a somewhat similar implementation where you may see REVALIDATED_HIT in the Cache-Control response header. This indicates that the cached content in Azure Front Door was revalidated with the origin server before being served to the client. This can happen when the cached content has expired, but the origin server indicates that the content hasn't changed. In this case, the cached content is served to the client, and the cache expiration is reset.

    Hope this helps! Please let me know if you have any questions. Thank you!


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful