How to stop index.html being cached by Azure CDN

断了今生、忘了曾经 提交于 2021-01-29 16:22:41

问题


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?


回答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



来源:https://stackoverflow.com/questions/61557904/how-to-stop-index-html-being-cached-by-azure-cdn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!