amazon-web-services - 在 Lighthouse 中获取 Preconnect to required origins 错误
问题描述
我刚刚将我的静态网站移动到 AWS S3 + Cloudfront 和 Route 43。一旦我部署了我的网站,我就运行了 Lighthouse 和 Pagespeed Insights,我得到了“预连接到所需来源错误!”。 在我移动我的网站之前,我没有收到这个错误,所以我认为这与我的 AWS 配置有关。这是我的 index.html 文件中的预连接。
<link rel="preconnect" href="//www.google-analytics.com" crossorigin>
<link rel="preconnect" href="//fonts.googleapis.com" crossorigin>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
我没有连接到任何其他 3rd 方,只有 Analytics 和 Google 字体。我是否缺少与云端的预连接?我在网上搜索了几天,还没有找到任何东西,所以我在这里。
解决方案
如果您直接向您的 Cloudfront 域发出请求,那么您也需要预先连接到它。
我不肯定,但你的href
标签值应该以 开头https
吗?
推荐阅读
- css - 如何在 Firefox 中使我的 SVG 元素上的 CSS @keyframes 动画更流畅且资源占用更少?
- arduino - 使用 .contains 时,错误 'class String' 没有名为 'contains' 的成员
- c# - no_connection_could 因为目标机器主动拒绝了
- javascript - Javascript 文件选择对话框 eventListener 未被调用
- vuetify.js - 如何淡出 Vuetify v-data-table 行
- r - R新手,有人可以解释一下下面的代码吗?
- indentation - 在 nano 中粘贴文本时如何消除级联缩进?
- c++ - 试图找到已删除的函数
- firebase - 使用 Kotlin 和 MVVM 的 Firebase 授权
- javafx - JavaFx 多行选项卡标题