用lighttpdredirect端口80上的websocketstream量
我有一个托pipe在lighttpd上的网站,可以在“www”子域访问。 我也有一个聊天服务器监听端口8124使用node.js和socket.io。
我希望所有的客户端stream量发生在端口80,通过redirect到“聊天”子域的所有请求到端口8124.所以我启用了mod_proxy和lighttpd.conf我补充说:
$HTTP["host"] == "chat.myserver.com" { proxy.server = ( "" => (( "host" => "78.128.79.192", "port" => "8124" )) ) }
在客户端,当我连接到websocket时,
var socket = io.connect('http://chat.myserver.com');
我从node.js得到正确的消息:
debug - client authorized info - handshake authorized 6067470561567883577 debug - setting request GET /socket.io/1/websocket/6067470561567883577 debug - set heartbeat interval for client 6067470561567883577 debug - client authorized for debug - websocket writing 1::
但浏览器提供了一个错误:
Firefox can't connect to server ws://chat.myserver.com/socket.io/1/websocket/6067470561567883577
当然,如果我直接连接到端口8124,一切工作正常:
var socket = io.connect('http://www.myserver.com:8124');
但是,正如我所说的,我希望所有的客户端stream量都在80端口上。是否可能?
已知mod_proxy与websockets不兼容。
HAProxy是兼容的(我没有自己testing过,但是这里有一个关于它的websocketsconfiguration的文章 )。