关于Hexo的Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure stylesh.

背景

  • 不知道什么原因,突然我的博客网站崩溃了,表现为渲染资源不出来,报错Mixed Content: The page at ‘’ was loaded over HTTPS, but requested an insecure stylesheet ‘’. This request has been blocked; the content must be served over HTTPS.。

这个问题说明,网站是通过HTTPS进行加载的,HTTPS被认为是安全的,但是网站请求了别的HTTP协议的资源.需要我们把http的资源请求转换为https的。

  • 我用的是hexo的matery的主题.关于域名是HTTPS还是http去解析,依赖与我使用的阿里云的域名解析服务,我使用的是https.也就是可以用通过https://域名 去访问到我的网站.

关于Hexo的Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure stylesh._第1张图片

解决办法

找到 themes\matery\layout\_partial\head.ejs 这个共用的文件,
关于Hexo的Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure stylesh._第2张图片

加上一句

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />

关于Hexo的Mixed Content: The page at ‘<URL>‘ was loaded over HTTPS, but requested an insecure stylesh._第3张图片

重新部署解决问题.F12看有没有报错,问题解决.(如下显示连接安全)

你可能感兴趣的:(Hexo,https,网络协议,http)