简体   繁体   中英

How to stop index.html being cached by Azure CDN

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!

在此处输入图像描述

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?

在此处输入图像描述

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 isreturned 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM