如何处理“拒绝设置不安全标头:连接”
How to Address "Refused to Set Unsafe Header: Connection"?
我使用Prototype结合CodeIgniter来提交AJAX请求。我的浏览器是Chrome。我在控制台收到一个错误,上面写着"拒绝设置不安全的头:连接"。下面是Ajax请求行:
new Ajax.Request('/vbs/index.php/signup/get_ratecenters',{method:'POST', evalScripts:true})
我尝试将类型设置为同步,但收到相同的错误。
有人能帮忙吗?
在prototype.js(1.7.0.0)中只有一个代码片段试图设置Connection: close
标头
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko'/('d{4})/) || [0,2005])[1] < 2005)
headers['Connection'] = 'close';
}
如果你使用prototype.js的本地副本,你可以将代码片段更改为
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
(navigator.userAgent.match(/Gecko'/('d{4})/) || [0,2005])[1] < 2005)
{
alert("Yes, this is it.");
if ( navigator.userAgent.match(/Gecko'/('d{4})/) ) {
alert("navigator");
}
headers['Connection'] = 'close';
}
}
,看看这是不是真正的原因。
如果直接在浏览器中加载/vbs/index.php/signup/get_ratecenters
会发生什么?
我在网上某处读到"拒绝设置不安全的头:连接"是一个警告,HTTP"连接"头不能设置,但并不意味着请求不会被处理,所以有可能这里发生了别的事情?
检查/vbs/index.php/signup/get_ratecenters
并确保它返回有效的JavaScript代码。执行该代码在Chrome控制台,并确保它是错误的自由…这里可能有不同的错误
相关文章:
- CORS保持在SecurityError上:操作不安全
- createObjectURL blob url在Firefox中不安全
- 地理定位API从Chrome 50中的不安全来源中删除
- 为什么流星会被认为是不安全的
- SecurityError:操作在canvas.toDataURL中不安全
- Mootools:拒绝设置不安全的标头“;连接”;
- Socket.IO socket.id 更改同一客户端而不重新连接
- Chrome for bookmarlet 中的“不安全内容”
- 为什么内联 JS 块不安全
- jQuery:Javascript抛出错误“;操作不安全”;设置值时
- AngularJS-ngBindHtml和'不安全'html
- HTML5历史API-操作不安全
- 刚将我的网站移到ssl,但我有不安全的内容
- 角度相加“;“不安全”;在尝试下载文件时将其转换为url
- Chrome扩展:不安全的JavaScript尝试访问具有URL的框架域、协议和端口必须匹配
- Safari 7,Mac OS X:确定Java是否处于'不安全'模式
- 业务催化剂原型核心.ashx 拒绝设置不安全的标头“连接”冲突
- 如何处理“拒绝设置不安全标头:连接”
- node . js /套接字.io在IE中不返回结果,使用安全连接
- 如何在有角度的模板中连接URL比在其他位置更不安全