Websockets with AWS and Elastic Beanstalk

Martok11 picture Martok11 · Dec 12, 2014 · Viewed 15.3k times · Source

I'm trying to get my websockets working with Amazon Web Service and Elastic Beanstalk (ELB).

I set up a proxy protocol according to: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-proxy-protocol.html

I've opened up all inbound traffic to my load balancer and other security groups on all ports, for all IPs.

I also kept the load balancer listerner as HTTP on port 80.

My websocket connection gives the following error when trying to connect on port 80: failed: Error during WebSocket handshake: Unexpected response code: 400

And this error on port 8080: failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Would appreciate suggestions, I'm stuck at this point.

Thanks!

Answer

Oleg Imanilov picture Oleg Imanilov · Sep 21, 2016

After configuring EC2 Security group your application will work with public IP.

But you still will get issue with using EB URL. To solve this issue, you have to change EB configuration.

  1. Go to EB environment page
  2. Configuration
  3. In Load Balancing section change protocol from HTTP to TCP.

Now you can click EB URL.