当请求是ws:// localhost时,chrome中的Websocket工作,但如果托管在某些IP上则失败

时间:2017-09-07 10:20:27

标签: google-chrome firefox nginx websocket socket.io

我有一个应用程序,从中建立了websocket请求。当我在我的localhost中托管应用程序时,所有的websocket请求都可以通过我本地的任何浏览器测试成功。

但是当我在另一台机器上托管相同的应用程序并从我的机器上测试它时。除了chrome和opera之外,所有其他浏览器似乎都可以工作,包括IE。

查看Firefox和Chrome的相同请求的区别

enter image description here

Firefox中的Websocket请求。 但是在Chrome中,我在网络日志中得到了以下内容

enter image description here

enter image description here

根据观察,我看到chrome允许使用localhost URL。我在本地和外部机器上使用nginx代理

不确定某些配置是否特定于浏览器

1 个答案:

答案 0 :(得分:0)

解决!如上所述它在Firefox和IE中运行良好,Chrome我必须在无代理模式下打开它,因为我在我的组织的代理下。

https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/IhulT2eCinE