I'm trying to find a way to get the two-http-request handshake that socket.io uses to stick to the same server without using cookies for persistence. Most of the guides I've found online all use cookies, but in my case, at least some of the (non-browser) client apps don't support them.
socket.io is a protocol that can be used over websocket (our main use case) but also supports several other fallback transport layers (xhr polling, jasonp, flash polling, etc). The protocol is described here: https://github.com/LearnBoost/socket.io-spec A sample of the request and response looks like this: * handshake to establish a session: the session id is returned in the response body GET /socket.io/1/ HTTP/1.1 User-Agent: node-XMLHttpRequest Accept: */* Host: 1.2.3.4 Connection: keep-alive HTTP/1.1 200 OK Content-Type: text/plain Date: Thu, 18 Apr 2013 19:14:44 GMT Transfer-Encoding: chunked 47 M7S2snisYW8uw3eUddC-:60:60:websocket,htmlfile,xhr-polling,jsonp-polling 0 * second request which upgrades to websocket with the socket.io session id specified in the url _path_ GET /socket.io/1/websocket/M7S2snisYW8uw3eUddC- HTTP/1.1 Connection: Upgrade Upgrade: websocket Sec-WebSocket-Version: 13 Sec-WebSocket-Key: MTMtMTM2NjMxMjQ4NDU2NQ== Host: 1.2.3.4 HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: o3FS8Zcg7KLSAx+MKOfkBndQCdE= I think that the session id from the handshake's response body can be extracted and stored in a stick table using something like stick store-response res.payload(0,20) however, I can't find any way to extract the session id from the url path and use that to lookup the server_id from the stick table. I think there are two problems which prevent me from doing this. The first is that there is no pattern extraction method which can extract a pattern from the url path. The second is that payload() extracts and stores a binary value and the patterns that can extract values from the request (query string, header, etc) all return a string. Can a string be used to match in a stick table which stores binary values? It seems that there is enough information in the first and second request to allow them to be stuck to the same server without resorting to cookies or src based stickiness but I don't see a way to do that with haproxy. I'm using 1.5-dev18 Thanks for any suggestions. -Bryan

