DEV Community

Discussion on: Docker 201: Use NGINX as a Reverse Proxy for NodeJS Server in 2020! 📦 🙌 (practical guide)

Collapse
reggietheroman profile image
reggietheroman

This is really interesting. Could you eli5 why one would need to use a reverse proxy at all?

Collapse
destro_mas profile image
Shahjada Talukdar Author

This is a really nice article-
cloudflare.com/learning/cdn/glossa...

Collapse
maximization profile image
Maxim Orlov

One reason is, you have multiple apps/websites hosted on the same server. Say you have a landing/marketing page at myproduct.com and a dashboard for user accounts at app.myproduct.com. They can't both listen port 80 (default http port). You set up a reverse proxy that listens to 80 and forwards traffic to the respective app based on the domain. The apps can listen to ports 3000 and 3001 for example.

Does that make sense?

Collapse
reggietheroman profile image
reggietheroman

I think so. Just so im sure i understood your explanation, internally they use 3000 and 3001, and when people hit up myproduct.com and app.myproduct.com, that goes to nginx which then forwards the request to the correct ports?

Thread Thread
maximization profile image
Maxim Orlov

Correct!

Thread Thread
reggietheroman profile image
reggietheroman

awesome. thanks so much!