Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Application platforms like Node.js and Tomcat can bind to port 80 and serve external requests directly.

Alternatively, these application platforms bind to a local port (like Tomcat's 8080) that is not exposed to external calls. A web server - like Apache or Lighttpd - proxy external requests from the web to the internal application platforms.

What are the reasons for adding a web server between the application platform and the external web?

share|improve this question
1  
This is a bit too broad and will result in opinion-based answers, but using an internal server allows for complex internal applications to be sectioned-off from public ones. For example, if you have an internal sales processing application, you could use node.js to develop internal UI's and database tie-ins, while using Apache to serve the public product catalog and inventory UI... This helps to keep data a bit safer (with proper management) and reduce server loads among other things. –  dan Feb 5 at 16:18
1  
@dan Thanks for your comments. I have revised my question to make it less opinion-based - I am asking for the reasons for adding the web server between external calls and the application platform. –  Adam Matan Feb 5 at 20:57
add comment

1 Answer

up vote 2 down vote accepted

There are quite a few reasons to do this, but I'll touch on two: scalability and availability.

Scalability: You may choose to reverse proxy your web-app so you can add more than one instance of your application. For instance, if you have 1 node process running on port 5000 but are using Apache/Lighttpd/Nginx/etc to route requests from port 80 to this resource bound to the local port you could start another instance on 5001, 5002, etc and then Load Balance (LB) these requests across each node process all via port 80. As your application grows, you could start to separate these functions into their own physical/virtual servers with little to no downtime.

Availability: Tied to our first example, if you have multiple node instances running (ports 500x) and need to do an update you could take one instance out of the LB pool at a time; update the server/code and re-add it to the LB pool.

Like I say, these are two of the main reasons (I'm sure some security folks could touch on benefits there) but I'm sure there are more. I'd suggest Googleing and reading posts related to high availability to learn more about how and why we do this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.