一、问题详情
Mixed Content: The page at ‘https://xxx’ was loaded over HTTPS, but requested an insecure test ‘http://xxx’. This request has been blocked; the content must be served over HTTPS.
注:上图中蓝色标记的【test】是http请求最后一级目录的关键字,也就是展示当前出现问题的目录关键字。
二、解决方式(两种方法选择其一即可)
2.1、方法一,在前端相应的HTML页面的head中加入meta标签元素(意思是自动将http的不安全请求升级为https),内容如下:
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
2.2、方法二,在Nginx的Server中配置【add_header Content-Security-Policy upgrade-insecure-requests;】文章来源:https://www.toymoban.com/news/detail-547726.html
server
{
listen 80;
server_name xxx.test.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/xxx.test.com;
add_header Content-Security-Policy upgrade-insecure-requests;
try_files $uri $uri/ /index.html;
gzip_static on;
}
文章来源地址https://www.toymoban.com/news/detail-547726.html
到了这里,关于【谷歌浏览器】中(Mixed Content错误,即是https请求http在浏览器中出现的错误)的解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!