By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Trouble with Websockets on elastic beanstalk node js envirom

0

Hello everybody,

I am currently trying to integrate Websocket into my server running on an AWS Beanstalk NodeJS environment. Unfortunately I get the error message in the browser:
WebSocket connection to 'wss: // ***' failed: Error during WebSocket handshake: Unexpected response code: 404
Local (localhost) everything is running fine.

On the server side, I log the calls and see that the value "upgrade" has not been transferred in the header.

In the Beanstalk configuration, I have a Classic Load Balancer deposited with the following configuration:

  • Port 443
  • Protocol SSL
  • Instance port 80
  • Instance protocol TCP
  • SSL Certificate: ...

In my deployment package is next to the server also the following file: .ebextensions / WebSocketsUpgrade.conf
with the following content:
container_commands:
enable_websockets:
command: |
sed -i '/\sproxy_set_header\sConnection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf

Have I missed something that needs to be configured?

Thanks a lot!

asked 6 years ago1.2K views
1 Answer
0

Hello, the problem is solved. It is an incorrect name of the config file, which has been adopted in many forums. The file name must be: WebSocketsUpgrade.config.

answered 6 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions