为什么我的https://请求取消并更改为http://,导致混合请求错误
Why is my https:// request cancelled and changed to http://, causing a mixed request error?
我有一些简单的延迟加载javascript:
script.type = 'text/javascript';
script.src = 'https://example.com/'+urlToJavascript;
script.onreadystatechange = callback;
script.onload = callback;
head.appendChild(script);
SSL在我的域名https://example.com/上运行。尽管https
在剧本里。src我得到这个混合内容错误:
The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure script 'http://example.com/js/lazyScript.js'. This request has been blocked; the content must be served over HTTPS.
我运行console.log(script)
,显示:
<script type="text/javascript" src="https://example.com/js/lazyScript.js"></script>
然后我转到检查器的网络选项卡,发现对https://example.com/js/lazyScript.js
的初始请求被提出,但随后被取消,其次是对不安全的http://example.com/js/lazyScript.js
的请求,然后由于混合内容而被阻止。
我以前从未遇到过这种情况,也不知道为什么会发生这种情况。
为什么会这样?
这可能是由于服务器级的一些重写。我也面临同样的问题,它是nginx以某种方式将url转换回http。尝试直接在浏览器中加载资源url,看看是否有重定向发生。如果是,返回服务器并修复重定向。
相关文章:
- Meteor如何接收HTTP请求
- 在我的情况下,如何进行http请求
- 使用插件收听Firefox标签的http请求
- Angularjs http.get() Cross-Origin 请求被阻止
- http请求使用html而不是json进行响应
- 在node-js路由中发出http请求
- 通过sdk/system/events在修改请求观测器上测试http
- 是否可以在没有HTTP请求或<输入>
- Acync JS HTTP请求通知请求
- PhantomJs在控制台中发出http请求时不会返回任何状态
- 当我在chrome中切换设备模式时,$http.get请求失败
- PHP处理来自一个页面的http请求,并将其显示在另一个页面上
- 使用angular js通过代理服务器请求Http
- 如何从HTTPS服务器请求HTTP服务器的javascript文件
- 阻止的跨来源请求:http://api.fixer.io/latest.
- 坏的请求.HTTP POST到api
- 有没有办法为AngularJS JSON请求($http/$resource)使用浏览器缓存?
- angular js在每个http请求$http上添加请求参数
- 当从不存在的站点请求HTTP响应时,Node.js脚本会中断
- 通过代理服务器请求HTTP呼叫