Comparison between proxy and reverse proxy server

Reading Time: 3 minutes

Proxy server:

A proxy server sometimes referred to as a forward proxy. Proxy server is a server that routes the traffic between clients and another system.

There are a couple of places in a typical web application flow where having a proxy makes sense and it is very common when we type in the URL and hit enter. Let’s say we want to enter Facebook on our browser and submit. Our request doesn’t directly go to the website, there is our internet service provider sitting in between us and the website who takes our request and then sends another request to the website. Our internet service provider or ISP is acting as a proxy for us. It sends request on our behalf.

There are couple of advantage in having a proxy. First, proxy can intercept our request and decide not to pass the request along in the case of blocked website. We can also choose to log or monitor request. Another advantage is that the proxy can cache requests instead of passing it through each time. Let’ us assume that there is certain static page that is accessed by multiple people and close to each other in terms of request times. The proxy can make just one request and then cache it when there are subsequent calls to the same page. The proxy will just return the cached response rather than make a new request again.

Reverse Proxy:

In contrast to this, there is another concept of reverse proxy. Forward proxy, proxy requests going out or forward whereas reverse proxy,proxy requests coming in.

A reverse proxy is a server that accepts a request from a client, forwards the request to another one of many other servers, and return the results from the server that actually processed the request to the client as if the proxy server had processed the request itself. The client only communicates directly with the reverse proxy server and it does not know that some other server actually processed its request.

Let us suppose we have hosted an application on a handful of servers. They could be micro services or multiple scaled copies of the same application. Now rather than have the client be aware of the nuance of how we set up our server. We set up a proxy server in front of these servers. This proxy is responsible for getting requests from the outside world and then make the right request to the right server. The right server get the response and then send that response to the right client.

The principle is kind of the same. In this case, the client doesn’t know what the actual sever is that handling the request. This is proxy but in reverse direction hence called reverse proxy.

Some advantage of reverse proxy:

The advantage of reverse proxy is security, when we host our application and start accepting requests, we can set up a reverse proxy that manages the security of our application. As our actual servers ISP hidden from the client. It makes our infrastructure a little more secure. Another advantage is caching. We can cache certain responses so that when the request comes in, we can send the response back without even bothering the server with it.

One very common use of reverse proxy is load balancing. When we have a scale application server i.e we can start up multiple instances of our same app server and depending on the load we can increase or decrease the number of instances. This load balancer reverse proxy can use a strategy like round robin to evenly distributed requests to the available servers.

Conclusion:

A forward proxy is a server that sits in front of a group of client machines. When those computers make requests to sites and services on the Internet, the proxy server intercepts those requests and then communicates with web servers on behalf of those clients whereas a reverse proxy is a server that sits in front of web servers and forwards client requests to those web servers.

Leave a Reply