ScalingReverse proxy

A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. A reverse proxy is used to provide load balancing services and, in some cases, caching services. In a load-balanced deployment, multiple reverse proxies are deployed to distribute incoming requests among a set of servers. In cases where caching is employed, the reverse proxies cache content retrieved from the origin servers and return cached content to subsequent clients without contacting the origin server

How Reverse Proxies Work 

In order to better understand reverse proxies, it helps to first understand what a proxy server is. A proxy server is a computer that acts as an intermediary between a client and another server (in this case, a reverse proxy). A client connects to the proxy server and requests information from a source (or sources), and the proxy server evaluates the request and takes action on behalf of the client. 

A reverse proxy is similar to a forward proxy, with one key difference—while forward proxies send requests on behalf of clients to servers, reverse proxies send requests on behalf of servers to clients. In other words, while forward proxies act as an intermediary between clients and servers, reverse proxies act as an intermediary between servers and clients. 

Reverse proxies are used for load balancing, caching, compression, encryption/decryption, SSL offloading (the process of decrypting SSL traffic before it reaches the server), and other purposes. 

An example of how Reverse Proxies work

Let’s say you own an e-commerce website that gets a lot of traffic. In order to ensure that your site can handle the influx of traffic without crashing or becoming slow, you can use a reverse proxy. The reverse proxy will take some of the load off of your main server by storing commonly accessed files (such as images) in its cache memory. When visitors access your website, they will be connecting to the reverse proxy rather than directly to your server—this takes some of the pressure off of your server, making your site faster and less likely to crash due to overwhelming traffic. 

Because reverse proxies can encrypt/decrypt data passing through them (a process known as SSL offloading), they can improve the security of your site by acting as a “man in the middle” between potential attackers and your server—if SSL is enabled on your site but not on the attacker’s side, they will not be able to decrypt traffic passing through the reverse proxy even if they are able to intercept it . 

How do you use a Reverse Proxy in System Design? 

Reverse proxies are typically used by organizations with multiple servers that need to be load balanced or with sensitive data that needs to be protected from direct exposure to the internet. When using a reverse proxy, you will need to configure your server to route requests through the proxy. The specifics of this will depend on your server software and the capabilities of your reverse proxy. Once your server is configured, your reverse proxy will handle request forwarding and load balancing as needed.