大网数据广告活动
网站运营与故障问答

Google intermittently fails to download CSS and JS from CloudFront CDN

· 52CE 我爱测

We noticed a lot of "Mobile Usability" errors in the Search Console. When I clicked on them and chose "Check live version" option - it always said the page was mobile friendly. However, the mobile usability errors didn't go away …

问题原文

原帖链接 · Ivan Nikitin · CC BY-SA 4.0

We noticed a lot of "Mobile Usability" errors in the Search Console. When I clicked on them and chose "Check live version" option - it always said the page was mobile friendly. However, the mobile usability errors didn't go away from the search console.

We continued testing and once or twice we got a "Page loading issues" error on top of the "Mobile Friendly Test" and the page was rendered with text content and images but CSS wasn't loaded.

It turns out Google Bot from time to time fails to download CSS from CloudFront distribution. This causes "Mobile Usability" errors in the Search Console and potentially search penalty.

We have a static website hosted on S3/CloudFront. CSS and HTML documents are on the same distribution. We have HTTP/2 enabled and I expect CSS to be served via the same connection as HTML. However, it doesn't happen from time to time and CSS fail to download. Errors happen rarely but yet they affect our website rankings.

CSS and JS are NOT in robots.txt

We have NO Geolocation restrictions.

There is NO errors originated from Googlebot in the CloudFront logs. I see only successful requests from Googlebot. There are errors from other users, so logs seems to work correctly.

Viewer protocol policy is set to Redirect HTTP to HTTPS.

Links to CSS are relative and look like that: https://www.visualwatermark.com/css/all-24c79a5ab7f0103302353199ecf9f1cf.css

The CloudFront distribution in question is https://www.visualwatermark.com/

Do you have any ideas what can be changed to ensure Google Bot always able to download CSS from CloudFront CDN?

已采纳解答

原帖链接 · drtechno · CC BY-SA 4.0

Copy the css code that is used in the page, and place it in-line in a style tag on the page.

This forces the css, and there is no performance hit, and in some cases, it will run faster as there is no request routines for a css page.

Also, the fonts need to be the standard fonts, or locally installed, but I prefer to use the standard fonts the browser chooses instead of loading fonts.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。