IE10 上的 WebSocket 出现 SecurityError [英] WebSocket on IE10 giving a SecurityError

查看:51
本文介绍了IE10 上的 WebSocket 出现 SecurityError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在 IE10(在 Windows 8 上)下开发一个网站,在 JavaScript 中使用 WebSockets.它在 Firefox 18 和 Chrome 25 下运行良好,但在 IE10 上,当我建立连接时出现 SecurityError.

I am currently developing a website under IE10 (on Windows 8), using WebSockets in JavaScript. It runs fine under Firefox 18 and Chrome 25, but on IE10 I get a SecurityError when I establish the connection.

我正在做的事情似乎很简单:

What I am doing seems pretty straghtforward :

websocket = new WebSocket('wss://hello.dev.mydomain.net');

但是 IE 不喜欢它:

But IE doesn't like it :

SCRIPT5022: SecurityError 

脚本位于https://test.dev.mydomain.net"(不是真实地址一目了然).

The script is on "https://test.dev.mydomain.net" (not the real address obviously).

让我烦恼的是,如果我只是双击本地计算机上的文件(例如 file://...),它就可以正常工作.更糟糕的是:如果我使用 fiddler 来监控 HTTP 流量......它也可以.而在没有 fiddler 的情况下似乎根本没有任何联系,如 API 规范中所述.(见下文.)

What bothers me is that if I just double-click the file on my local computer (e.g. file://...) it just works. Even worse: if I use fiddler to monitor HTTP traffic... it also works. Whereas there seems to be no connection at all without fiddler, as detailed in the API's specs. (See below.)

websocket 规范来看,异常也应该出现在 Chrome/Firefox 上......但它没有.所以我怀疑它与 HTTP/HTTPS 有什么关系.无论如何,我在 httpS 页面上使用 wsS 套接字......此外:当我用在线示例中找到的另一个有效服务器替换 wss 地址时,它可以工作.

Judging by websocket spec, the exception should also appear on Chrome/Firefox... but it does not. So I doubt it has anything related to HTTP/HTTPS. In any case, I am using a wsS socket on a httpS page... Moreover: when I replace the wss address by another valid server found on an online example, it works.

我不知道这是否相关,但是来自 test.dev.mydomain.net 的 IP 是 10.14.x.x,其中 hello.dev.mydomain.net 是 194.247.x.x.我不知道它是否只能在 IE 上触发某种安全性...

I don't know if this is relevant, but the IP from test.dev.mydomain.net is 10.14.x.x where hello.dev.mydomain.net is 194.247.x.x. I don't know if it could trigger some kind of security on IE only...

还有一件事:我有 *.dev.mydomain.net 的证书,IE 似乎没有问题.该脚本最初驻留在名为 my.name.dev.mydomain.net 的服务器上,但由于我从另一个 URL 访问它(我得到了重定向,因为我们首先认为它可能是某种同源策略问题),我不明白这有什么关系.至少我希望它不会......

One more thing: I have a certificate for *.dev.mydomain.net, IE does not seems to have problems with it. The script originally resides on a server called my.name.dev.mydomain.net, but since I am accessing it from another URL (I got a redirect since we first thought it could have been some kind of Same Origin Policy issue), I don't see how it could matter. At least I hope it does not...

欢迎提出任何想法.

将站点添加到受信任区域也不起作用.

adding the sites to the trusted zone does not work either.

推荐答案

嗯,我的问题没有那么成功,所以我会发布我找到的解决方法".

Well, my question wasn't that successful, so I'll post the "workaround" I found.

我得到了另一个网站地址,在 194.247...这神奇地解决了它.猜猜 IE 不喜欢混合本地和外部的东西并监视 IP.

I got another address for the website, in 194.247.. too. This, magically, solved it. Guess IE doesn't like mixing local and external stuff and watches the IP.

无论如何,我希望这对遇到同样问题的人有用.

Anyways, I hope this may come in handy to anyone who's got the same issue.

如果您有通过配置 IE 来解决真正"问题的解决方案,请告诉我:)

If you have a solution to solve the "real" issue by configuring IE, let me know :)

干杯,

这篇关于IE10 上的 WebSocket 出现 SecurityError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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