解决Mixed Content:the page at‘https://' was loaded over HTTPS,but requested an insecure resource 'http://'

问题:在Vue项目中使用axios访问了一个http协议的接口,报错如下

查资料后发现原因是在https中请求http接口或引入http资源都会被直接blocked(阻止),浏览器默认此行为不安全,会拦截。

解决办法:

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

在页面中加上此meta标签,原理是使用META标签强制将http请求转成https(SSL协议)请求。                                                                                                                                                                                                                                                                                                      

原文地址:https://www.cnblogs.com/527xyz/p/14870576.html