当你的才华不能撑起你的野心时,就是你该选择学习的时候了!

Content-Security-Policy

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

 

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

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

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

 

页面是 https 的,而这个页面中包含了大量的 http 资源(图片、iframe等),页面一旦发现存在上述响应头,会在加载 http 资源时自动替换成 https 请求。

 

posted @ 2020-03-08 15:32  hofmann  阅读(779)  评论(0编辑  收藏  举报