Https异常This request has been blocked; the content must be served over HTTPS
Posted 756623607-zhang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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-insecure-requests" />
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> </head> <body> <script type="text/javascript"> </script> </body> </html>
以上是关于Https异常This request has been blocked; the content must be served over HTTPS的主要内容,如果未能解决你的问题,请参考以下文章
在普通网页显示正常,加Https报This request has been blocked; the content must be served over HTTPS.,https网站加载http
getReader()/getInputStream() has already been called for this request
getOutputStream() has already been called for this response 从了解到解决
异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.
1. SpringBoot启动后,报异常:This application has no explicit mapping for /error, so you are seeing this as
getOutputStream() has already been called for this response解释以及解决方法