API gateway - Reverse proxy - Forward Proxy - Load Balancer - What not !!! — CONFUSED??

Well, most of the developers find themselves confused when they are dealing with such terminologies. I, myself was very much bewildered when I encountered those terms. Here, I figure out few basic differences/similarities and try to give you a taste about what these actually mean.

Okay, let me dive into the topic right away. First, let’s talk about reverse proxy.

In simple terms, reverse proxy is nothing but a simple server, that sits between a client(internet) and other back-end servers, takes a request from the clients, carries it to other servers, gets response from the servers and returns it to the respective clients. Sounds simple right. The figure below explains it in a very lucid manner. Client = Alice and Other Server = Bob.

Source : https://en.m.wikipedia.org/wiki/File:Proxy_concept_en.svg

In technical aspects, reverse-proxy has a lot of jobs to do. Such as re-routing incoming requests to several other servers, with each server performing a specific task. For this, reverse proxy may need to rewrite the URL in each incoming request object, in order to get it delivered to appropriate server. However Service registry and discovery concept is used to decide which API is connected with which server, which request belongs to which server etc. Reverse proxy is also used for other applications such as load balancing, web acceleration, security etc.

Okay, that’s too much of technical description. Here’s a simple picture that demonstrates reverse proxy technically.

Source : https://www.imperva.com/

Now let’s have a brief intro about forward-proxy. Let’s have a visual representation first to have a better understanding of the explanation. The following figure demonstrates the forward proxy pictorially.

Source : https://www.imperva.com/

Forward proxy is also an intermediate server, that sits between the end user’s system and internet. Well, forward-proxy technology is implemented to achieve various functionalities such as monitor end-user’s online activities, block application and origin servers from malicious traffics and attacks etc.

Okay too much of proxy-proxy we had. Let’s explore, what an API gateway is and how it is different from reverse-proxy. As defined by RedHat, an API gateway is an API management tool that sits between a client and a collection of back-end services.

API gateway actually acts as a reverse-proxy to intercept all the API calls and sends them to the back-end services. On top of that, it has other features such as authentication, rate limiting, load-balancing, service registry and discovery etc. Let me brief you about these terms a bit.

We can have an authentication functionality incorporated in our application which can be used for validating users, licenses etc before proceeding with further activities. We can connect a billing system feature with our application if we want to monetize our software services/APIs.

Rate limiting suggests controlling the incoming and outgoing traffic of a server, i.e. if a service’s API is configured to entertain 100 requests/minute, we can either throw an error or keep the other requests in queue etc when the limit is exceeded.

Load balancing capability is heavily determined by how we have implemented service discovery functionality. Service discovery means :- if there are five server instances hosted for say, Login/Signup functionality, then the API gateway should be smart enough to decide to which server instance out of those 5 it should redirect an incoming Login/Signup request. The decision is made considering various factor of each individual instances such as number of current active connection, throughput, idle time since last request processed etc.

An API gateway holds a lot of other features such as security, protocol translation, activity or behavior tracking etc. One of the benchmark API gateways is the NetFlix’s API gateway. We won’t go that deeper for now.

These concepts highly encourage application development following a micro-service architecture which itself is a vast technical concept.

The following picture demonstrates a basic API gateway architecture.

Source : https://www.nginx.com/

I hope, I was able to clear few confusions and concepts regarding the topics demonstrated above. Do give a clap if you liked this article.

Technology Enthusiast | Software Engineer | Distributed Systems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store