In this article, we have explained the Concept of Reverse Proxies, why it is important and the applications of Reverse Proxies. This is an important topic in System Design.
Table of contents:
- Introduction to proxy servers
- Types of proxies
- Forward (open) proxy
- Reverse Proxies
- Importance of Reverse proxies
Introduction to proxy servers
In english language the word proxy refers to the authority to represent someone else in a certain capacity i.e to be able to act or perform some functions on behalf of that person. In terms of computer networks, proxy servers are servers which sit in front of clients (forward proxies) or in front of servers (reverse proxies) in order to perform certain functions on behalf of, or control access to the clients or servers. It may seem counter-intuitive to add an extra node in the network seeing that we usually want to reduce the number of hops our requests make to get to the destination server but using proxy servers provide alot of benefits which totally justify their presence in a network. In this article, we'll be looking at some types of proxies before focusing mainly on reverse proxies. We'll also talk about their uses and the advantages they provide on the network.
Types of proxies
Proxy servers can be grouped in to two types, depending on where they are found on the network i.e. is the proxy server closer to the client or closer to the destination server on the network. Let's look at the two types a little more closely
Forward (open) proxy
this is a type of proxy server which sits in front of clients on a network. All client requests pass through the proxy server which in turn forwards it to the destination server or another proxy server on the other end. There are several reasons why clients might use a proxy server they include:
- Monitoring and filtering: Goverment organisations, schools, private companies may want to block some traffic to and from certain sites on their network for several reasons e.g. to prevent distraction of staff or students or to avoid inappropriate content. A forward proxy can be used to achieve this.
- Anonymity: Some web clients might prefer to be anonymous while browsing the internet. In order to achieve this such web client might choose to pass their request through a proxy server which then forwards the request to the final destination. This then means that instead of the destination server getting the clients IP address and other information it gets the proxy servers info thereby allowing the client to remain anonymous. It is important to note that not all proxy servers hide a clients info.
- By-passing Restriction (Government restriction): In some countries network traffic to certain sites is restricted by goverment for one reason or the other. In such countries citizens can by-pass such restrictions by using a proxy server. This is possible because access to the proxy server is unrestricted and the proxy server is located in an area where it is allowed to access the restricted website. So the proxy server forwards requests from the clients to the website and sends back responses from the site back to the client.
This type of proxy sits in front of a bunch of servers on a networks and controls access to those servers. A reverse proxy accepts traffic from the internet and then determines the destination server to forward such traffic to.
Importance of Reverse proxies
In the classic client server architecture, you have a server several clients which can make request to a server which is capable of handling those requests and sending responses back to each client. So web developers create their aplications place them on servers and users can access those applications(websites) from the server. Usually this is fine for applications with a few users, but what if the application has say a million or a billion active users accessing the site regularly. In such a situation a single server will not be able to handle the traffic alone (at least not efficiently), multiple servers will be needed in order to ensure there is no crash of the server. In such an architecture we need a proxy server which accepts incoming requests, determines the serve which has the less busy at the moment and forward the request to that server. Let's take another scenario where an app is served by only one server. This is risky because if that single server develops a fault or is down for some reason it means the application users will not be able to access the application until the fault has been rectified or the server is replaced. This is unacceptable nowadays. To remedy this we will need multiple servers for redundancy along with a proxy server which controls how those servers are accessed. Below I will outline some of the functions which a proxy sever performs on a network.
Load balancing: In the two scenarios we looked at above, we saw the importance of serving an application using multiple servers. However when using multiple servers in order to reap the benefits we have to ensure that the worload is shared equally among all the servers so we don't end up with a situation where a single server or some servers get alot of requests while the others sit idle or when a server is down we need to ensure that no requests are sent to that server. This is called load balancing, it is a function which is performed by the reverse proxy.
Serving an application from multiple locations: A web application may be served from servers in different countries or continents for some reasons such as redundancy, government regulation or to increase speed. In this case a proxy server receives a request and forwards it to a server which is closest to the clients location.
Compression: Sometimes a proxy server is used to compress data before being sent to the client in order to reduce its size and improve load time.
Concealing information about destination servers: A reverse proxy server can be used to hide information about the actual servers which are responsible for handling the client requests.
In conclusion with this article at OpenGenus, the importance of proxy servers and reverse proxies in particular on the internet cannot be over emphasised. They help improve security, allow for anonymity, improve speed and allow users bypass restrictions and censorship among other uses which are very vital to the smooth operations of a network and the internet at large.