-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookie based sticky sessions support? #775
Comments
I see lot's of recommendations for using query strings, but I'm not if HAProxy supports sticky-sessions using query strings. I also need to check whether that requires custom code on the client side. |
I sort of understand that cookies are not allowed: Just to clarify:
The following thread seems interesting: |
We figured it out (using url parameters): socketio/engine.io#207 (comment) |
It seems the issue has been solved. |
Hi @peteruithoven I'm facing the same problem, can you please give me more detail how it was resolved? |
@fithwith would that example help? (cookie-based sticky session with haproxy). |
thank you @darrachequesne I already have this config, which resolved part of the problem, which is the socket from the browser side, but in my app I have another client which is a nodejs client using socket.io-client module and with this client the cookie solution is not working because I'm unable to get and send back this cookie to the server, I ready found some possible solutions, one tweaking xhr module from the client in order to send cookie but I didn't find a way to receive the cookie from the server and another solution about using url_param in haproxy but didn't understand how its working from the client side. |
+1 on this, I have a working implementation that only works when connecting from a browser, but the minute I want a node.js app to connect, I get: |
I'm using AWS Application Load Balancer (ALB) and it uses a cookie for sticky sessions, but the socket.tio-client does not suppport cookies. |
@darrachequesne Any updates on this? |
Any updates ? |
@jonathanroze hi! Please check the example here: https://socket.io/how-to/deal-with-cookies#nodejs-client-and-cookies |
Thanks a lot !! |
I'm using HAProxy to load balance between different node instances. I've enabled sticky sessions using cookies, so that I can easily test the load balancing behind the same remote ip address.
But I'm noticing that it doesn't work in Node.js, while it does work in a browser.
The error I receive is
xhr poll error
, which is what I usually get when I forget to enable sticky sessions.My theory is that socket.io-client running in Node.js, doesn't accept the cookies from HAProxy. I've seen several issues around cookies but never in combination with sticky sessions.
Issues like the following don't seem hopeful:
socketio/engine.io-client#304
#587
Code example:
HAProxy:
The text was updated successfully, but these errors were encountered: