How do I customize nginx on AWS elastic beanstalk to loadbalance Meteor?


I am running Meteor on AWS Elastic Beanstalk. Everything is up and running except that it’s not running Websockets with the following error:

My unstanding was to add something like:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

To the proxy config, via my YML config file.

Via my .exbextension config file:

I have ssh’d into the server and I can see the proxy.conf with those two lines in it.

When I hit my webserver I still see the “Error during WebSocket handshake: ” error.

I have my beanstalk load configured with stick sessions and the following ports:

enter image description here
enter image description here

BTW I did see and I tried to:

Enable HTTP load balancing with Sticky Session on Port 80
Enable TCP load balancing on Port 8080, which allows websocket

But could not seem to get that working either.

Adding another shot at some YAML that does NOT work here”:

Any help appreciated?


With a LOT of help from AWS paid support, I got this working. The reality is I was not far off it was down to some SED syntaxt.

Here’s what currently works (Gist):

In addition to this you need to got into your Load balancer and change the Listener from HTTP to TCP:

enter image description here

described here:

Leave a Reply