欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Mixed Content: The page at loaded over HTTPS but requested an insecure XMLHttpRequest endpoint 自己亲自做的 有大用 有大大用 有大大大用

The page at 'https://aaa.com/admin/build/views/edit/bd_sh_gjz_baobian_ribao' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://aaa.com/admin/build/views/ajax/config-item/bd_sh_gjz_baobian_ribao/default/field/field_bd_gjz...'. This request has been blocked; the content must be served over HTTPS.


Mixed Content: The page was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint. This request has been blocked; the content must be served over HTTPS.

帕特里克的图片

状态:活性»固定

通过在settings.php中设置HTTPS base_url来解决


我是通过 如下的方法来设置的,如果多个域名,可以通过 $_SERVER['HTTP_HOST']来判断 

不同的 $base_url;

if($_SERVER['HTTP_HOST']=='w.aaa.com'){

    $base_url = 'https://w.aaa.com

}

if($_SERVER['HTTP_HOST']=='w.bbb.com'){

    $base_url = 'https://w.bbb.com

}



image.png

来自 https://www.drupal.org/project/simplytest/issues/2607132


Mixed Content: The page at 'xxx' was loaded over HTTPS, but requested an insecure resource 'xxx'.


HTTPS页面里动态的引入HTTP资源,比如引入一个js文件,会被直接block掉的.在HTTPS页面里通过AJAX的方式请求HTTP资源,也会被直接block掉的。

image.png

Mixed Content: The page at 'xxx' was loaded over HTTPS, but requested an insecure resource 'xxx'. This request has been blocked; the content must be served over HTTPS.

解决办法:

页面的head中加入:

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

意思是自动将http的不安全请求升级为https

注意:在需要的网页上加上面的语句,

其它不需要的网页不需要加,不然会出错的。

CSP设置upgrade-insecure-requests

好在 W3C 工作组考虑到了我们升级 HTTPS 的艰难,在 2015 年 4 月份就出了一个 Upgrade Insecure Requests 的草案,他的作用就是让浏览器自动升级请求。

在我们服务器的响应头中加入:

header("Content-Security-Policy: upgrade-insecure-requests");

 

转载:https://blog.csdn.net/u012259256/article/details/72039950

https://www.cnblogs.com/hustskyking/p/upgrade-insecure-requests.html



来自  https://blog.csdn.net/haibo0668/article/details/82947917

普通分类: