Close

What is a proxy server

The dictionary meaning of the word proxy is the following.

the authority to represent someone else, especially in voting.

In client server architecture of computing, a proxy server is a middleman between the client and the server.

When we access the internet using clients such as a browser, or mobile etc, they connect to the server via the internet.

A proxy server sits in between the client and the server and acts as a middleman. There are primarily two types of proxy servers.

  1. Forward proxy or simple proxy server
  2. Reverse proxy server

A proxy server, also called a forward proxy or a web proxy sits in between the group of clients and the internet. When a client sends a request, the proxy intercepts it, and forwards it to the server on behalf of the client. Similarly when a server responds, it forwards the response to the client on behalf of the server.

But why do we need a middleman between the client and server which will potentially introduce a delay?

Well, there are some advantages of having them. A Proxy can be used

  1. To bypass restrictions placed by organizations on their employees while accessing the internet. For example some organizations use firewalls to block access to some websites like gambling, social networks etc. The firewalls disallow connections to these servers. In such cases, clients can bypass this restriction by connecting to a proxy and access blocked servers/websites through it. If the organization is stricter, the firewalls can even block proxy servers. However it will be too difficult to block all available proxies simply because there can be too many of them.
  2. Quite contrary to the above case, some organizations allow their employees to access the internet only through a proxy. In this mechanism, the users can’t directly access the internet without going through a proxy. The same proxy can be used to block access to certain websites and content.
  3. Identity protection: If a user connects to the internet via proxy, it is difficult to trace the activities of the individuals. This is because the origin servers know only the address of the proxy server and not that of a client. This prevents the privacy of the users.

Now, let us try to understand how a reverse proxy works. Unlike a forward proxy that sits in between the clients and the internet, a reverse proxy sits in between the internet and the servers. A reverse proxy forwards client requests to the servers, and also forwards the responses to the clients from origin servers. 

The primary uses of a reverse proxy are the following.

  1. Load Balancing: A reverse proxy can act as a load balancer by evenly distributing the client requests among several servers.
  2. Security: Since a reverse proxy hides the servers behind it, server addresses are not directly exposed to the clients. So it is difficult for a malicious user to attack the servers using techniques such as DoS (Denial of Service)
  3. Faster Content Delivery: A reverse proxy can also act as a router of client requests to geographically nearest servers based on the client location. This generally happens when an application is widely popular across several locations in the world (Eg. Google, Facebook etc.) This will help reduce the network latency between the client and the servers. Content delivery networks (CDN) such as Akamai, Cloudflare etc use the same mechanism.
  4. Caching: A reverse proxy can also act as a caching server to speed up the frequently accessed content from the servers. This will reduce the load on the origin servers. However, there should be proper cache invalidation mechanisms to always serve the latest content.
  5. Encryption: A reverse proxy can handle the encryption/decryption of the messages between the client and the servers (SSL/TLS). In this way, we can reduce the load on the origin servers by letting them concentrate only on the business logic.

References:

  1. Cloudflare

Leave a Reply

Your email address will not be published. Required fields are marked *