Non-Cached Data Being Served as Cached Data in Front Door

Glenn Darrin 0 Reputation points
2023-10-02T06:46:41.36+00:00

I have a Front Door / CDN with caching enabled that uses the response from an API Management service to determine what specific content to cache.

The API Management service has a set of endpoints, the majority of which are set to cache-control: no-cache with a few set to cache-control: s-maxage: [length].

When deploying these caching changes to API Management and then enabling the cache on Front Door / CDN I observed a behaviour in Front Door that it responded with cached data for data I have explicitly set to cache-control: no-cache. This continued for a short duration until I: Purged Front Door, Disabled Front Door Caching, and then rolled back the policy change in API Management.

What I understand that happened in this instance was that if the Front Door changes had been made first or the changes to API Management failed for whatever reason then Front Door caches everything.

However, when I re-attempted this change again, making sure the API Management changes were completed first; I still observed the same behaviour - observing (what I explicitly set as non-cached data) being returned by the cache.

network_diagram

Are there any known issues with regards to the propagation of deploying changes to API Management and suitable mitigations, i.e. the changes need to reach all instances, to avoid this occurring?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,794 questions
Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
594 questions
Azure Content Delivery Network
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 36,396 Reputation points Microsoft Employee
    2023-10-05T10:05:17.4+00:00

    @Glenn Darrin

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to understand the caching behavior of Azure CDN/AFD.

    First, we must understand how the "no-cache" directive works.

    The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server.

    This does not mean the contents will not be cached to begin with.

    Refer : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

    Now,

    • May I ask if you are using a CDN or Azure Front Door?
    • If it's a CDN, which of the below are you using?
      a. Azure CDN Standard from Microsoft b. Azure CDN Standard from Akamai c. Azure CDN Standard from Edgio (formerly Verizon) d. Azure CDN Premium from Edgio (formerly Verizon).
    • If it's an AFD, is it
      a. Classic or
      b. Standard or
      c. Premium ?

    For CDN,

    For AFD,

    P.S:

    Note that no-cache does not mean "don't cache". no-cache allows caches to store a response but requires them to revalidate it before reuse. If the sense of "don't cache" that you want is actually "don't store", then no-store is the directive to use.

    Should there be any follow-up questions or concerns, please let us know and we shall try to address them.

    Thanks,

    Kapil

    0 comments No comments