Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Reverse Proxy and why should I use it with Node.JS?

Ryan Dahl recommends using Node.JS behind a reverse proxy (i.e nginx). Well.. what is reverse proxy? Any why should I use it with node.js? Is it wrong that my Node.JS app will serve all the content and all the traffic?

Thanks in advance.

like image 765
Pono Avatar asked Feb 25 '23 06:02

Pono


1 Answers

what is reverse proxy?

Try to look at wiki article.

why should I use it with node.js?

If you are using node.js only for a certain parts/functionality of your application and other stuff is served by different web application framework for example, then reverse proxy can be used to determine which requests go to node.js and which go to the other framework. This way your application can run on the same port and act to clients as a standalone system. Without it you will probably have to server incoming requests separately for node.js and other framework on different ports (if they are both on the same machine for example). There are also other use cases of reverse proxies, like load balancing.

Is it wrong that my Node.JS app will serve all the content and all the traffic?

No, it's not wrong. It's specific to you and your needs or scenario.

like image 194
yojimbo87 Avatar answered Feb 26 '23 18:02

yojimbo87