Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantages of a reverse proxy in front of Node.JS

People also ask

Why should I use reverse proxy?

Security and anonymity – By intercepting requests headed for your backend servers, a reverse proxy server protects their identities and acts as an additional defense against security attacks.

What is reverse proxy Nodejs?

A reverse proxy is basically a special type of web server which receives requests, forwards them to another HTTP server somewhere else, receives a reply, and forwards the reply to the original requester. A reverse proxy doesn't usually send the exact request, though. Typically it will modify the request in some manner.

What is the biggest advantage in using node JS?

Node. js has been regarded as a full-stack JavaScript for serving both the client and the server-side applications. Therefore, the advantage is that you don't have to hire separate developers for backend as well as the front-end development. It saves both your valuable money and time.

Is Nodejs front or back end?

Yes, Node. js can be used in both the frontend and backend of applications.


I think the greatest benefit is that you're then able to use the same port (80) for multiple applications. Otherwise, you'd need a new IP address for each nodejs application you have. Depending on how you set things up, you can also configure different folders and subdomains to different nodejs apps running on different ports. If you're building something big or complex, this is pretty great. Imagine being able to run your APIs on one node application, your website from another, and the logged-in website (member's area, dashboard, etc.) in another app. Your load balancer can determine who needs to go where (example.com/api* -> api.js, example.com/dashboard* -> dashboard.js, example.com -> app.js). This is not only useful for scaling, but also when things break, not everything breaks at once.

To the maturity thing, meh. Nodejs + forever + node-http-proxy = Amazing. Run 1 proxy server for all of your apps with a minimal config/complexity (lower chance of failure). Then have fun with everything else. Don't forget to firewall off your internal ports, though ;).

Some people make note of load balancing, which true, is a benefit. However, load balancing isn't something that most people will benefit from, since a single threaded, non-blocking nodejs thread can handle quite impressively large loads. I truly wouldn't even consider this as a difference if I were you. Load balancing is easy enough to implement when you need it, but otherwise utterly useless until you do.

Also note, if you do go with a non-node proxy solution (nginx, tornado, etc.), just be sure NOT to use one that blocks. Apache blocks. Nginx doesn't. You don't want to throw away one of the greatest benefits of using nodejs in the first place on a crummy server.


Having a more mature software as proxy is better for security and reliability. Nginx, Apache and others have been tested against a multitude of cases and used in production for years.

You can also use features from these web server that otherwise you would have to implement yourself or use a node.js module. Like caching, statistics, balancing, etc.

On the other side you would lose some features from node.js, realtime features like websockets (on port 80, you can still use other ports), page buffering and depending on the reverse proxy used, control over your caching and headers.

Edit:

  • NginX now supports websocket proxying and possibly others.
  • Apache has a module to proxy websockets.

Reverse proxy really helps to improve the performance when you especially dealing with the SSL and gzip compression. Also, there are many other advantages. Thanks to Thomas Hunter II(Intrinsic). Read whole blog here https://medium.com/intrinsic/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca