AWS Web sites with Elastic Beanstalk

I am trying to get my websites to work with Amazon Web Service and Elastic Beanstalk (ELB).

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

I opened all incoming traffic to my load balancer and other security groups on all ports for all IP addresses.

I also supported listerner load balancing as HTTP on port 80.

In my network connection, the following error appears when trying to connect to port 80: failed: Error during handshake WebSocket: Unexpected response code: 400

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

Thank you, I’m stuck at this point.

Thanks!

+8
amazon-web-services amazon-elb websocket
source share
4 answers

After setting up the EC2 security group, your application will work with a public IP address.

But you still run into the problem of using the EB URL. To solve this problem, you need to change the EB configuration.

  • Go to the EB environment page.
  • Configuration
  • In the "Load Balancing" section, change the protocol from HTTP to TCP.

Now you can click EB URL.

+5
source share

AWS has launched a new application load balancer that supports network sockets. Change your ELB to the application load balancer and this will fix your problem.

https://aws.amazon.com/blogs/aws/new-aws-application-load-balancer/

+2
source share

You must create a reverse proxy for the Nginx server. You can include this configuration file in the .ebextensions folder to make Nginx WS support.

Also, in the EBS load balancing configuration, change the protocol from HTTP to TCP.

enter image description here

Post this blog to set up a secure WebSocket.

+2
source share

I also looked for a possible workaround for this problem, but it is quite easy, no matter what platform language you use to develop the websocket program on AWS EC2, since I use Node.js nginx in my case, this should work for all supporting platforms.

Configure Security Group

  • In the AWS console, click the EC2 tab.
  • Select the appropriate region and click "Security Group".
  • You must have a default security group to protect against viruses if you run an instance of Elastic Beanstalk in this region for your application.
  • Click the "Actions" button at the top and select "Edit Inbound Rules."
  • here, in the "Type" column, select "All TCP", or you can install some custom TCP and also listen to your port on the network.

    What is it!

Note. If something doesn’t work, check the Events tab in the Beanstalk app / environments and see what went wrong.

+1
source share

All Articles