Firefox Websocket安全问题

时间:2012-08-01 22:00:17

标签: firefox websocket

我们在Linode框上的端口8080上设置了websocket服务器。 Chrome和Opera工作得很好。然而,Firefox抱怨操作不安全。

"操作不安全:代码18"

如果我在页面加载之前尝试在Web控制台中创建一个新的WebSocket对象,一切都很好。但是,在页面加载后,某些东西变得棘手,我就再也无法创建对象了。请参阅随附的屏幕截图。enter image description here

我不知道哪种手术不安全,甚至不知道如何诊断。

6 个答案:

答案 0 :(得分:49)

我修好了。应用程序本身在SSL下,但访问的websocket不是。 Chrome和Opera并不关心,但Firefox确实如此。根据:

https://bugzilla.mozilla.org/show_bug.cgi?id=303952

这是已知的并且不被视为错误。 Mozilla的回应:wontfix

解决方案,将websocket服务器置于SSL下并使用wss://

答案 1 :(得分:48)

正如您在另一个答案中指出的那样,默认情况下在Firefox上不允许使用https:// to ws://。

转到firefox的about:config和切换network.websocket.allowInsecureFromHTTPS将摆脱SecurityError。

答案 2 :(得分:0)

这是基于有限信息的预感,我可能应该把它放到评论中,但我没有足够的声誉点来做到这一点。

查看你的日志,似乎24秒从收到[object Websocket](时间17:46:36.683)开始,直到你得到The connection to ws://.....(时间17:47:00:952) )错误消息。长时间延迟让我相信服务器可以超时并关闭websocket连接。查看this answer可能的解决方案。

答案 3 :(得分:0)

遇到相同的问题,并尝试通过更改network.websocket.allowInsecureFromHTTPS中的about:config来解决问题。

最终找到了此帖=> Unhandled Rejection (SecurityError): The operation is insecure. On a fresh create-react-app project

在index.js中进行更改最终对我有用

serviceWorker.register();
//serviceWorker.unregister();

答案 4 :(得分:0)

在firefox中打开“ about:config” URL。搜索allowInsecureFromHTTPS并将其设置为true

答案 5 :(得分:0)

除了安全的ssl上下文和跨域策略外,分配一些端口也会触发错误。

什么是Firefox的有效http端口?我不确定,但必须介于150064000之间,否则控制台将显示:

SecurityError: The operation is insecure.

http链接将显示:

This address is restricted

This address uses a network port which is normally used for purposes other than Web browsing.
Firefox has canceled the request for your protection.

enter image description here