Using NGINX as reverse-proxy

I’m experimenting with deploying an app to AWS Elastic Beanstalk.

By default, NGINX is used as a reverse-proxy (this is in addition to an optional Elastic Load Balancer that you can choose to use).

Does the community here really see any advantage to using a reverse-proxy? Will you only see benefits if there’s lots of concurrent users and Websockets staying open?

I’m aware of NGINX websocket issues, however I’m not seeing it when using Meteor v2.2 on this app.

Mind it, mine is not an expert opinion on this matter.

  • With Nginx you can load balance multiple app instances running in parallel within the same host. I’m not sure if an ELB can do that within the same host.
  • Nginx is also useful to deliver semi-static content bypassing your app, e.g. prerendered page snapshots for search engines (e.g. from redis)
  • I use Nginx to conditionally deliver a static page for the old Internet Explorer users, as the app wouldn’t even start
  • Finally I also have a static page to be delivered by Nginx in case my app instances are down for any unforeseen reason.

You can also use Nginx to prevent some weird requests. It would be useful in case your servers got DDOS attack.


That (prevent ddos) is really great IMO. I don’t want meteor to spend time on trying to work on WP or php weird requests. And nginx together with fail2ban works it out perfectly.

I have never had an issue with nginx over sockets, using it on every project


These are all great points and new things for me to learn. We will be having the app only accessible internally on our VPC through VPN (through a Security Group setting). And so, I won’t be overly concerned with weird requests or DDOS.

@stanp I’d dealt with weird WP requests last week and it scared me for a hot minute there. Btw, this is the WS issue I was referring to javascript - Meteor WebSocket connection to 'ws://.../websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 - Stack Overflow

We’re moving from Heroku after ~3 years, and this did not provide a reverse-proxy by default. So - I don’t think I’ll introduce one just yet.

There is a comparison table here that pretty much explains the options. For most, NGINX Open Source should be enough. If you are truly rich, AWS Application Load Balancer is what you need :slight_smile:

1 Like