3

I am using Azure CDN to host a static website I am building.

It's great, other than the fact that when I update my web app the old page is cached and so still shown.

I have added the following Cache rule in the rules engine to put it to refresh every 60 seconds, however this does nothing and I still get the old content, the only way to get the new content is to go to an incognito browser.

Anyone have any ideas it's driving me crazy!

enter image description here

Here is a screenshot of the browser dev window when I hit the index.html page, I can't see any cache control headers here, I would think that the Azure CDN would/should be putting these on, is that incorrect?

enter image description here

user3284707
  • 2,645
  • 2
  • 25
  • 57

1 Answers1

1

The rule you are modifying controls the "internal max age". If a file shows up correctly in icognito mode, this rule is working fine. You have to set "external max age" to control the Cache-Control header.

https://docs.microsoft.com/en-us/azure/cdn/cdn-verizon-premium-rules-engine-reference-features

Looks like it is not Azure CDN which is caching index.html, it is your browser. Ensure that the Cache-Control header is returned correctly by using the developer tools.

https://docs.microsoft.com/en-us/azure/cdn/cdn-manage-expiration-of-cloud-service-content

https://docs.microsoft.com/en-us/azure/cdn/cdn-manage-expiration-of-blob-content

Alex AIT
  • 13,403
  • 3
  • 29
  • 59
  • But shouldn't the CDN be setting the Cache-Control header based on what I have put in the rules engine configuration, or am I misunderstanding? – user3284707 May 02 '20 at 19:12
  • No, this is done by the "external max age" rule. You have to set this to control the Cache-Control header. I have also added this to the header. – Alex AIT May 02 '20 at 19:16
  • Where do I set this I am unsure of where I can configure this in Azure CDN? – user3284707 May 02 '20 at 19:18
  • In your screenshot, you have "force internal max age". There you have to select "external max-age" – Alex AIT May 02 '20 at 19:19
  • Ahh ok - I have set this now. So if I am thinking right, the difference between the internal and external max age. Is the internal age is how long the CDN caches it for and extrenal age is how long the browser caches it for? – user3284707 May 02 '20 at 19:22
  • Thanks so much! It’s quite annoying none of the tutorials mention this at all. I can’t believe no one else has had this issue before! I’ll set to answered when the rule has propagated and I can test it outs thanks so much for your help! – user3284707 May 02 '20 at 19:31
  • Sorry I forgot to mark as done. Yeah it did work... kind of. It has added the max age headers on. However the page is still not refreshing after that age has past. I'm pretty confused at this, it does seem to change but not till about a day or two later which is really annoying. – user3284707 May 07 '20 at 07:13