Friday 2 June 2017

Socket.io polling behind AWS ALB and nginx

I have a problem with proper configuration of socket.io behind ALB and nginx. Nginx has a configuration which includes adding websocket upgrade header. What I found for now is that if I set transport method only to websocket

var socket = io({transports: ['websocket'], upgrade: false}

it works well - I can establish correct websocket connection.

The problem starts when socket.io is using polling first. It starts with HTTP GET and HTTP POST which results with 400 Session id unknown. I also noticed that socket.io using generated cookie to match requests related to the same connection transfered in header (io). Is it possible that this is the a problem? If so is there any solution - ALB has in its documentation that it doesn't suport cookies other that self generated.



via kadiii

No comments:

Post a Comment