首页 > 解决方案 > Cloudfront 被锁定在 index.html

问题描述

我有以下分布。 https://dhzcuvpl3uus.cloudfront.net

为了相似起见,我有两个对象:

当我第一次访问(在硬缓存或 icognito 模式之后)manifest.jsonhttps://dhzcuvpl3uus.cloudfront.net/manifest.json)对象时,我可以看到内容。

但是,在访问index.html对象后,我无法访问manifestjson。即使我manifest.json通过 url 请求对象,它也会显示 index.html。

它可以用硬缓存修复。

这种行为的原因是什么?

标签: amazon-web-servicesamazon-cloudfront

解决方案


原因是您的清单正在工作。

在你的清单上,你有

"start_url": "./index.html"

在您的 index.html 中,您有:

<link rel="manifest" href="/manifest.json">

因此,一旦调用 index.html,您的浏览器就会缓存您的“Web 应用程序”起始 URL 为 ./index.html ...

即使您尝试访问 -> https://dhzcuvpl3uus.cloudfront.net/shazam ,它也会从 manifest.json 调用浏览器缓存中的内容

./index.html

Tl dr:您的清单正在运行,并且您的浏览器正在缓存。


推荐阅读