apache - Why is Lighthouse failing my cached files?
问题描述
I'm using Google Lighthouse to calculate a performance score. One of the criteria is caching static assets such as images and scripts.
I don't have control over all of these, but the ones I do have control over the cache has been set to 30 days. However, Lighthouse is still reporting these as an issue. Lighthouse does report these as having a 30d cache, but still reports as an issue.
What do I need to do to rectify this?
Please see screenshot below:
解决方案
我还有一个 30 天的缓存策略,为我解决这个问题的方法是将 public 和 no-cache 值添加到 Cache-Control 标头。
我只是在测试 Firebase 托管与我的旧主机(即 IIS)时才发现这一点。IIS 托管站点正在通过,即使它的 max-age 值更短。我检查了 chrome 中的网络开发人员工具,发现它在我的 IIS web.config 中的 Cache-Control 标头下有公共和没有缓存值,但我的 firebase.json 没有这些值。一旦添加,我再次通过!
现在为什么这对我来说是一个谜,但看看你是否可以再次添加和测试。
推荐阅读
- python - 在 Tensorflow 中重新格式化张量
- javascript - fetchById 无法在反应中呈现状态,但 console.log 正确呈现状态
- django - 关于 Wagtail 的初学者问题(与 Django 相比)
- javascript - Puppeter 未使用指定的 chrome-profile
- c# - 如何生成 A-2 PDF
- regex - 正则表达式:替换引号,大括号内除外
- javascript - 如何使 axios.get 同步?
- java - 找出数组的第一个或最后一个位置是否有整数“6”
- c - 对矩阵进行冒泡排序以按升序获取一些字符
- excel - 将数据从excel推送到word文档