haproxy和socket.io无法正常工作 [英] haproxy and socket.io not fully working

查看:147
本文介绍了haproxy和socket.io无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了博客和stackoverflow中发布的所有可能的haproxy配置,但是我仍然无法使haproxy和socket.io能够100%地正常工作.在大多数支持"网络套接字的浏览器中,它会失败,并且会在心跳缺失后重新进行长时间的轮询.浏览器似乎建立了初始连接(nodejs调试),但是我无法让客户端接收连接响应.还有其他人有类似的问题吗?以下是我尝试过的软件版本号和一些配置.

I have tried every conceivable haproxy configuration posted in blogs and stackoverflow, but I still cannot get haproxy and socket.io to work 100% of the time. In the majority of browsers that "support" web sockets it fails and falls back on long polling after missed heart beats. The browser appears to make the initial connection (nodejs debugging), but I cannot get the clients to receive the connection response. Is anyone else having similar problems? Below are the software version numbers and a couple of the configs I have tried.

  • haproxy 1.4.18
  • 节点0.6.5
  • socket.io 0.8.7

Haproxy配置(我尝试了更多很多选择):

Haproxy configurations (I have tried many more and numerous options):

  • http://engineering.bistri.com/post/14307969768/socket-io-haproxy-http-authentication
  • HAProxy + WebSocket Disconnection
  • http://pastebin.com/H3XNv0TQ
  • http://www.darkcoding.net/software/proxy-socket-io-and-nginx-on-the-same-port-over-ssl/ (minus ssl stuff)

Web套接字在以下位置工作:

Web sockets working in:

  • Safari 5(Windows)
  • Chrome 11(Linux)

推荐答案

Websockets不能反向代理,因为在Content-Length标头中没有广告标头之后,客户端必须发送的8字节数据在握手完成之前不会转发该数据.而且由于握手需要完成这8个字节,所以握手永远不会完成并死锁,因此 http://www .enotes.com/topic/WebSockets#Proxy_traversal .这不是唯一的来源.许多来源证明他们不能被反向代理.

Websockets cannot be reverse proxy'd because the 8 bytes of data the client must send after the headers is not advertised in a Content-Length header, so the intermediates won't forward that data until the handshake completes. And since the handshake needs those 8 bytes to complete, the handshake never completes and deadlocks, http://www.enotes.com/topic/WebSockets#Proxy_traversal. This is not the only source. Many more sources verify that they cannot be reverse proxy'd.

这篇关于haproxy和socket.io无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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