Forward Proxy vs Reverse Proxy
Going through some system design videos, I realized that I have been using the term Proxy incorrectly all this time. So let’s quickly discuss it so that you don’t make the same mistake.
TLDR;
The position of a proxy — is what makes a proxy either a forward or reverse proxy. The easiest way to remember the difference between these two proxy is -
Forward proxy is used by clients where as Reverse proxy is used by servers
Forward Proxy
Whenever a request is made by a client, it must pass through the forward proxy before reaching the server. Since the forward proxy acts as a ‘client’ for every request, the server is only aware of the forward proxy and not the original clients.
The best example of how a forward proxy can help you is by bypassing a network block. Rather than directly connecting to the server, you connect via a forward proxy.
Reverse Proxy
In case of a reverse proxy, the clients are unaware of the actual servers. Every request is directed to reverse proxy which handles all the communications from thereafter. A reverse proxy acts as a gateway for your backend, hiding all other servers.
Some of the uses cases for a reverse proxy includes authentication and caching. It also increases security since the clients are only aware of the reverse proxy.
Reverse proxies are not exactly load balancers. It is completly ok to have a single server behind a reverse proxy
That’s about it! Thank you for reading, and I hope you enjoyed the article.