This article was originally published at https://www.blog.duomly.com/6-most-popular-backend-questions-and-answers-for-beginners/#what-is-reverse-proxy-and-how-it-works
What is a reverse proxy and how it works?
I think that at first, I should explain what proxy is, also called the forward proxy. Let’s take a look at the visualization of the forward proxy.
In this image, you can see how the communication with the forward proxy looks like. The request is sent from the client, and then the request takes over the proxy server, which communicates with the servers to get the data and send them back.
There are a few reasons why the forward proxy can be used.
First of all, it’s used to avoid browsing restrictions, for example, companies sometimes limit access to the internet, and the proxy can be used to overcome it.
The second idea is why the forward proxy may be used to stay anonymous on the internet because when we send the request through the proxy, the only visible IP is the one form the proxy server.
Now, let me explain what the reverse proxy is, and for that, let’s take a look at the other graphic.
In the case of the reverse proxy, the proxy server is between the network and the application origin server with data. When the client does a request, it’s sent to the network, and then it’s grabbed by the reverse proxy server, then the request sent to the origin server, and the response is returned.
The main advantages of using the reverse proxy server are:
- preventing the attacks like DDoS, because the attackers won’t be able to hit the origin servers of the application, just the proxy server;
- helps in caching content;
- provides the SSL encryption;
- can help to distribute the requests to multiple origin servers;
- can add basic HTTP access authentication to a web server that doesn’t have one.
There exist the third-party reverse proxy servers like Cloudflare.
Thank you for reading,
Anna from Duomly