Search code examples
azure-cdnazure-caching

Why azure cdn returns me the old version of file with custom domain


I have a file uploaded to my azure storage, and now I have replaced it with another version of this file. The old file size was 22 mb. now the new version is about 10 mb. After replace when I try to download the file with my custom domain it still downloads the old file(22 mb). But when I try to download with it's original url(storageName.blob.core.windows.net) I get the correct file.

I have tried to set cache-control header 1 minutes using Microsoft azure storage explorer.

max-age=1

But it didn't help.

Why is such kind of behavior? And how to solve this problem?


Solution

  • When you have a CDN configured with Azure Storage and you updated the file in Storage, CDN will still serve the cached old file until the TTL expires.

    So you should either do a Purge or you need to configure the caching rules to get desired rules.

    You can read more about Caching rules in CDN here.