This content should also be served over HTTPS

HTTPS 是 HTTP over Secure Socket Layer,以安全为目标的 HTTP 通道,所以在 HTTPS 承载的页面上不允许出现 http 请求,一旦出现就是提示或报错:

Mixed Content: The page at ‘https://domain.com/w/a?id=074ac65d-70db-422d-a6d6-a534b0f410a4‘ was loaded over HTTPS, but requested an insecure image ‘http://img.domain.com/images/2016/5/3/2016/058c5085-21b0-4b1d-bb64-23a119905c84_cf0d97ab-bbdf-4e25-bc5b-868bdfb581df.jpg‘. This content should also be served over HTTPS.

很多运营对 https 没有技术概念,在填入的数据中不免出现 http 的资源,出现疏忽和漏洞也是不可避免的。

解决办法一:CSP设置upgrade-insecure-requests

W3C工作组考虑到了我们升级HTTPS的艰难,在2015年4月份就出了一个Upgrade Insecure Requests 的草案(http://www.w3.org/TR/mixed-content/),他的作用就是让浏览器自动升级请求。
在我们服务器的响应头中加入:

server {
  ...
  add_header Content-Security-Policy upgrade-insecure-requests;
  ...
}
 

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

方法二、
页面中加入 meta 头:

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

目前支持这个设置的还只有 chrome 43.0,不过我相信,CSP 将成为未来 web 前端安全大力关注和使用的内容。而 upgrade-insecure-requests 草案也会很快进入 RFC 模式。

原文地址:https://www.cnblogs.com/exmyth/p/11634644.html

时间: 2024-08-04 16:02:14

This content should also be served over HTTPS的相关文章

Mixed Content: xxx This request has been blocked; the content must be served over HTTPS.

在升级https的过程中,出现如下问题: Mixed Content: The page at 'https://www.xxx.com/denglu.html' was loaded over HTTPS, but requested an insecure script 'http://qzonestyle.gtimg.cn/qzone/openapi/qc-1.0.1.js'. This request has been blocked; the content must be serve

在普通网页显示正常,加Https报This request has been blocked; the content must be served over HTTPS.,https网站加载http资源时,http资源被block

解决办法 :在html头加<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">问题解决 原文地址:https://www.cnblogs.com/zhouguomao/p/11450921.html

【Https异常】This request has been blocked; the content must be served over HTTPS

一.问题出现场景 项目从http升级到https后,jsp页面存在发送http请求的情况下就会出现该异常.因为HTTPS 是 HTTP over Secure Socket Layer,以安全为目标的 HTTP 通道,所以在 HTTPS 承载的页面上不允许出现 http 请求. 二.解决办法 在jsp页面中,添加下面的meta头就可以了 <meta http-equiv="Content-Security-Policy" content="upgrade-insecur

让浏览器不再显示 https 页面中的 http 请求警报

HTTPS 是 HTTP over Secure Socket Layer,以安全为目标的 HTTP 通道,所以在 HTTPS 承载的页面上不允许出现 http 请求,一旦出现就是提示或报错: Mixed Content: The page at ‘https://www.taobao.com/‘ was loaded over HTTPS, but requested an insecure image ‘http://g.alicdn.com/s.gif’. This content sho

关于https不支持http的解决方案

由于在写md的时候截图是用的微博的图床,上传到github才发现不让在其他网站使用,所有本文只有一张图片. 刚才进行网站测试的时候,微博秀这个插件不能显示出来,一直是空白, 然后我把本地域名改成了127.0.0.1,显示出来了. 可是部署到github以后还是显示空白,我以为是网络问题, 但是检查了一下才发现报错了. Mixed Content: The page at 'https://www.taobao.com/' was loaded over HTTPS, but requested

Let&#39;sEncrypt 免费通配符/泛域名SSL证书添加使用教程

Wildcard certificate俗称野卡正式点一般称为通配符或泛域名证书,也就是为*.lnmp.org 签发包含所有子域名的SSL证书,从去年6.7月份左右就已经说过Let'sEncrypt将于2018年1月支持,但是几次放鸽子后最近终于证书支持了.通配符证书一般还是比较贵的一般最便宜的通配符证书5.60美元一年,只不过Let'sEncrypt的有效期是3个月,对于一般用户来说基本没差别. LNMP 1.5已经添加了对通配符证书的支持,生成通配符证书和Let'sEncrypt平常SSL证

谢冠岚的个人学习网站

HTTPS 是 HTTP over Secure Socket Layer,以安全为目标的 HTTP 通道,所以在 HTTPS 承载的页面上不允许出现 http 请求,一旦出现就是提示或报错: --– Mixed Content: The page at 'https://domain.com/w/a?id=074ac65d-70db-422d-a6d6-a534b0f410a4' was loaded over HTTPS, but requested an insecure image 'h

http升级https的时候,遇到一个问题

问题: Mixed Content: The page at 'https://api.xxxx.com/test' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.xxxx.com/test'. This request has been blocked; the content must be served over HTTPS. 添加这个: <meta http-equ

转载 Mixed Content Page

网站配置了https之后,网页上的百度地图无法正常显示,报错类似于: Mixed Content: The page at 'https://url_1' was loaded over HTTPS, but requested an insecure script 'http://monitor_analytic.js'. This request has been blocked; the content must be served over HTTPS. 原因可能是: 1. HTTPS页