如何停止由Azure CDN缓存的index.html [英] How to stop index.html being cached by Azure CDN

查看:46
本文介绍了如何停止由Azure CDN缓存的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure CDN托管要构建的静态网站.

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

很棒,除了我更新Web应用程序时旧页面被缓存并仍然显示的事实.

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

我在规则引擎中添加了以下Cache规则,使其每60秒刷新一次,但是什么也没做,我仍然得到旧内容,唯一获得新内容的方法是使用隐身浏览器

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!

这是当我点击index.html页面时浏览器开发窗口的屏幕截图,我在这里看不到任何缓存控制标头,我认为Azure CDN将会/应该将它们放进去,这是不正确的?

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?

推荐答案

您要修改的规则控制内部最大年龄".如果文件以icognito模式正确显示,则此规则运行正常.您必须设置外部最长期限"来控制Cache-Control标头.

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/zh-CN/azure/cdn/cdn-verizon-premium-rules-engine-reference-features

好像不是Azure CDN在缓存index.html,而是您的浏览器.确保通过以下方式正确返回 Cache-Control 标头使用开发者工具.

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/zh-CN/azure/cdn/cdn-manage-expiration-of-cloud-service-content

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

这篇关于如何停止由Azure CDN缓存的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆