Foward Proxy Vs Reverse Proxy

Foward Proxy Vs Reverse Proxy

Before getting into the difference between forward and reverse proxy let's understand what is proxy service in general. A proxy acts on behalf of another machine. The final destination machine will have no idea which the request originated from. To put in a more real-world example let's say you want to get something from a small shop but you can't go as you are sick so you requested your friend to get it for you. Your friend goes to the shop and gets it for you. The person who runs the shop has no idea for whom your friend bought things as your friend acts on behalf of you. In other words, your friend is a proxy who acts as an intermediary between you and the shop. This is exactly what a proxy service does, acts as an intermediary between request and response. In other words, a proxy is something that hides a computer's identity during network communication.

Mainly there are two types of proxies,

  1. Forward proxy
  2. Reverse Proxy

Forward Proxy

When people talk about proxy servers mostly they mean forward proxy only. Forward proxy sits between a client (user) and the web server and it hides the client's identity from the server. Any request from the client to the server passes through the proxy server which sits in between the client machine and web server. In general, we can say forward proxy passes the request from the client to the server so that server will have no idea about the client's identity.

A classic use case where you can use a forward proxy would be to test a website that provides content based on a region. For example, you are based in the Netherlands and you want to test how contents are displaying for a user in India. In this scenario, you can connect to a proxy server in India, and the proxy server forwards your request to the application server which fulfills the request. When the server receives a request from the proxy server located in India it will have an Indian IP address so the server thinks this request originated from India and it returns back content specific to India to the proxy server and the proxy returns the same contents back to you. Here you have masked your identity from the server and behave as if you are accessing the website from India but in fact not, thanks for the proxy server.

No alt text provided for this image

Reverse Proxy

Reverse proxy behaves exactly opposite to forward proxy, hence the name "reverse proxy". A reverse proxy hides the identity of the server from the client, which means when a client sends a request to the server, the client will have no idea which machine will actually fulfill the client's request. The reverse proxy server forwards the client request to the server but the client will have no idea to which server the reverse proxy server routes the request to. As far as the client is concerned request is fulfilled by the machine where the client communicated, which is the reverse proxy server. So here the proxy server hides the identity of the server from the client, which is exactly opposite to the forward proxy.

No alt text provided for this image

Reverse proxy has more real-world use cases than the forward proxy. A classic use case of a reverse proxy is load balancing. When a client accesses a website, which has a load balancer the request from the client reaches the load balancer but the load balancer is not the machine that fulfills the request instead load balancer forward to request to one of the available servers. The server which receives the request from the load balancer fulfills the request and sends it back. So the client who sends the request has no idea which server actually processes the request as the client knows only about the load balancer and the load balancer hides the actual servers from the client. Here load balancing server is nothing but a reverse proxy server.

No alt text provided for this image

Another use case of a reverse proxy is the API gateway. API gateway sits between the client and the backend Apis. API gateway routes the request from the client to the backend APIs. Before forwarding the request to the backend APIs API gateway can perform various tasks such as rate limiting, authentication, formatting the request, etc.

No alt text provided for this image

To view or add a comment, sign in

More articles by Vijayanath(Vijay) Viswanathan

Others also viewed

Explore content categories