SEC7118:/socket.io/1/?t=1370206038749的XMLHttpRequest需要跨源资源共享(CORS) [英] SEC7118: XMLHttpRequest for /socket.io/1/?t=1370206038749 required Cross Origin Resource Sharing (CORS)

查看:920
本文介绍了SEC7118:/socket.io/1/?t=1370206038749的XMLHttpRequest需要跨源资源共享(CORS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个nodejs应用程序在一个服务器上运行在端口443(apache侦听禁用)与以下node.js包:

I have a nodejs app on one server running on port 443 (apache listening disabled) with the following node.js packages:

Express: 3.2.1
Socket.io: 0.9.14
Request: 2.21.0
Node: 0.11.1

然后我在第二个服务器上启用了node.js模块的drupal站点。我建立了一个聊天,它使用nodejs应用程序在第一个提到的服务器。所有好到现在,痛苦后,我设法得到它所有的工作。所有,但在IE10。
我在IE10的控制台中得到错误:

I then have a drupal site on a second server with the nodejs module enabled. I built a chat which uses the nodejs app on the first mentioned server. All good til now, after much pain I managed to get it all working. All but in IE10. I keep getting the error in IE10's console:

SEC7118: XMLHttpRequest for https://mynodejs.com/socket.io/1/?t=1370206038749
required Cross Origin Resource Sharing (CORS). 

据我所知,IE10完全支持CORS。不知何故,这个错误不会停止socket.io本身的加载,并且websocket被打开。在我的node.js应用程序的日志中,用户被授权并添加了他的频道。在网站上,使用IE10的用户可以看到其他人,甚至发送消息给他人。但他无法接收来自其他聊天用户的邮件...

As far as I know, IE10 fully supports CORS. Somehow, the error does not stop the loading of socket.io itself and a websocket is opened. In my node.js app's log, the user is authorised and his channel added. On the site, the user using IE10 can see others, even send messages to others. But he cannot receive messages from other chat users...

我设置了node.js应用程序以返回基本CORS的正确标头:

I set the node.js app to return the correct headers for basic CORS:

Access-Control-Allow-Origin    https://mydrupalsite.com
Access-Control-Allow-Headers    Origin, X-Requested-With, X-File-Name, Content-Type, Cache-Control
Access-Control-Allow-Credentials    true         //with or without, it makes no difference

我故意没有包括我的node.js应用程序的任何代码,因为它完全在任何其他浏览器上工作。
任何人都能知道发生了什么事?任何人成功获得一个node.js应用程序在IE10上工作

I intentionally did not include any code from my node.js app as it's fully working on any other browser. Can anyone tell what's going on? Has anybody succeeded to get a node.js app working on IE10??

推荐答案

AFAIU,SEC7118不是一个错误,通知。我已经google了,但没有找到任何MS网站的代码引用;反正你可以找到7118消息,当CORS工作正常为IE10。
本文档的重点是CORS和IE10阐明了我的意思(它绝对值得一读):
http://blogs.msdn.com/b/ie/archive/2012/02/09/cors-for-xhr- in-ie10.aspx

AFAIU, SEC7118 is not an error but just a notification. I've googled but didn't find the code reference on any MS site; anyway you can find 7118 messages when CORS works fine for IE10. This document focused on CORS and IE10 clarify what I mean (and it's definitely worth reading): http://blogs.msdn.com/b/ie/archive/2012/02/09/cors-for-xhr-in-ie10.aspx

无论如何,我发现你的问题,当解决某种nodejs聊天(实际上,一个BOSH支持js聊天客户端) IE10。在我的情况下,结果证明IE10在发送请求时将一些NS1:添加到某些xml属性,打破了。

Anyway, I've found your issue when troubleshooting some sort of nodejs chat (actually, a BOSH backed js chat client) on IE10. In my case turned out that IE10 prepends "NS1:" to some xml attributes when sending requests, breaking things up.

因此,您应该仔细检查您的xml有效内容微妙的差异(像我们发现的)IE10和其他(工作)浏览器之间。希望这有助于。

So, you should carefully check your xml payload looking for subtle differences (like the one we found) between IE10 and other (working) browsers. Hope this helps.

这篇关于SEC7118:/socket.io/1/?t=1370206038749的XMLHttpRequest需要跨源资源共享(CORS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆