nginx proxy websocket to multi nodes

linbo nginx-forum at nginx.us
Tue Sep 23 03:11:08 UTC 2014


I use nginx as proxy server, backend are socketio services. Follow the
[document](http://socket.io/docs/using-multiple-nodes/)  ,  nginx
configuration, ip_hash instruction that indicates the connections will be
sticky.

    upstream socketio {
        ip_hash;
        server server1:3000;
        server server1:3001;
        server server2:3100;
        server server2:3101;
    }

But for this configuration, same client request always proxy to same backend
server. 


If want same server request proxy to different backend server, have tried
[hash
directive](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash)
but doesn't work

    upstream socketio {
        hash "${remote_addr}${remote_port}";



Any solution?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,253475,253475#msg-253475



More information about the nginx mailing list