I've recently started creating an application using the microservice architecture, as the app evolves the line that divides the concepts of a reverse proxy and an API Gateway fades for me:
I want to use nginx to handle load balancing & reverse proxying, but I also want to use an API Gateway so the clients don't know every microservice in the architecture, (among other things).
So now I'm stuck with the chicken & the egg issue, I've been thinking about what comes first :
I tend to think its number 1 but in that case, nginx wouldn't be the entry point of the application... (is that a problem?)
Ideally you should opt for option 2. Here is why:
API gateways are generally not designed to handle a potential DOS attack, having nginx infornt of your gateway removes that worry from mind.
Most API gateways are route based, if you opt for subdomains, option 1 will only work with some gateways but 2 will work for all.
A reverse proxy like nginx is built with performance in mind, and can handle more requests at lesser costs. Having a Node.js infront of a much higher performant server is a bottleneck!
An API gateway is technically a "specialized" reverse proxy. So eventually you will realize tasks can be performed by either .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With