What is Proxy ? (Forward Proxy vs Reverse Proxy)
In system design, there are different ways through which we can route requests and perform intermediary actions between the client and server. We have proxies, load balancers, gateways, service mesh, and others in the list. In this article, we will learn more about proxies and their types.
INTRODUCTION :
A proxy is an intermediary piece of hardware or software that is positioned between the client and the backend servers to support the following operations.
- Routing to the correct server
- Security Protocols: A proxy can block or prevent requests between the internet and intranet, thus masking the servers from any client attack.
- Caching: It can serve as a cache too, thus decreasing unnecessary load on the servers.
- Load-balancing: If a web service uses multiple origin servers, a reverse proxy can distribute requests among them to ensure even server loads.
TYPE OF PROXIES :
While studying proxies, it’s very important to understand the types of proxies and the way they are used in the system design. A proxy mainly handles the requests that are coming to the server from an external network, and vice-versa. Based on this, we have two different types of proxies:
- FORWARD PROXY
- REVERSE PROXY
Let’s understand each of them in detail while clearly drawing out the differences between them.
FORWARD PROXY:
- It is used to pass requests from an isolated, private network (the Intranet) to the Internet through a firewall. Thus, it routes requests to an external network, by enforcing all the necessary security protocols.
- Using a forward proxy, requests from an isolated network, can be rejected or allowed to pass through a firewall.
- It sits in front of client endpoints to intercept incoming requests and ensure no servers communicate directly with a client, such as a web browser.
- It doesn’t contain a load balancer.
REVERSE PROXY :
- It is generally used to pass requests from the Internet through a firewall to the intranet. Thus, the reverse proxy gets the request from the external client, which is then sent to the servers downstream. In this way, a reverse proxy protects the server from attacks and any other overwhelming traffic.
- It sits in front of the server and prevents Internet clients from having direct, unmonitored access to sensitive data residing on content servers on an isolated network, or intranet.
- It contains a load balancer, thus helping in routing to multiple servers.
This was an easy, clear, and concise understanding of proxies in general. In the next article, we will learn more about simplified concepts of system design. I hope you liked it. Thanks :)