Parse Server, Live Query and AWS LB

Today my partner has problem to create connection for Live Query to an AWS server deploy with Elastic Beanstalk, so I have to see why he is not able to start a websocket connection.

Currently, that Parse Server is running on a EC2 instance within a VPC, with an iptable routing request from AWS LB to Nginx.

My partner has tried couple things.  Switch from AWS classic LB to Application LB, and also enable stickiness on the request.  However, he was still stuck.

After Google like everyone do, I found that  “NGINX supports WebSocket by allowing a tunnel to be set up between a client and a backend server. For NGINX to send the Upgrade request from the client to the backend server, the Upgrade and Connection headers must be set explicitly

The setting is simple, I just added those header in Nginx configuration file, and Live Query Setting is working!

 

For more information how to upgrade request, this is the link:

https://www.nginx.com/blog/websocket-nginx/

Read More