haproxy and socket.io not fully working

陌路散爱 提交于 2020-01-07 02:16:30

问题


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
  • node 0.6.5
  • socket.io 0.8.7

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 sockets working in:

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

回答1:


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.



来源:https://stackoverflow.com/questions/8662377/haproxy-and-socket-io-not-fully-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!