In a land far far away, there was a King. The king had a beautiful daughter…
Wait a minute, there must be a king and a princess to make it a tale, right? And you guessed it right there should be a country boy too. It’s a love story, man. Better than ‘twilight’, of course.
So, the country boy had fallen in love with the princess. The princess is soft for him too. But there is no way for the boy to contact with the princess because of the guards at the palace. But here comes the BFF of the princess to rescue. The BFF of the princess is happened to be acquainted with the boy too. So whenever the boy needs to send any message to the princess, he sent it to the BFF and she passed it to the princess. Same way the response from the princess comes back to the boy via the BFF.
I don’t know what happened next but can assume that something good happened and they lived happily ever after.
So, let’s make it clear how this is related to the topics I am going to write about. Did you ever face a situation where you can’t access to a site from your educational institute/home/office because it is blocked or you don’t have access to the network outside you are working? Or you wanted to see a youtube video but can’t because it is not available for your country?? What did you do next? If you are clever you might have used some application called ‘proxy’ which bypasses all these restrictions and get you the content you wanted. Yup! that’s right, you are the ‘boy’, this proxy is the BFF of our princess and the site is the princess which we want to contact.
Simply speaking, a ‘proxy server’ is a go-between or intermediary between you and your origin server. Generally, when you browse a site or a service, your PC/device send request to the origin server which hosts the site/service and send you back the content you wanted. But in terms of proxy you send the request to the ‘proxy server’, it gets your request which let it know which server you wanted to contact, then it contact with the origin Server, get the content and send it back to you. Simple as that.
In general, there are two types of proxy servers, which are known as:
- Forward proxy server
- Reverse proxy server
In ‘forward proxy server’, the origin server doesn’t know who the actual requestee is. The server assumes that the ‘proxy server’ is the actual requestee.
On the other hand, ‘reverse proxy’ is kind of the inverse of the ‘forward proxy’. In that case, think that the main server is secured behind a protected network, and you can’t directly contact with it. You wouldn’t really know where it is actually. You can only access to a proxy server, in this case it is known as ‘reverse proxy server’, and the proxy server will connect with the actual server to get you the content. You/client would assume that the proxy server is the origin server.
Need a single line simple explanation? Here it goes:
Forward Proxy: Acting on behalf of a requestor (or service consumer)
Reverse Proxy: Acting on behalf of service/content producer.
Now, what would be some of the uses for forward and reverse proxies? (source)
Forward proxy server
- Accessing blocked sites over SSL
- Serving geo restricted content by identifying servers within approved location
- Caching proxied content to improve speeds to frequently used sites
Reverse proxy server
- Balancing loads between multiple disparate servers
- Redirecting traffic to a secondary server when undergoing maintenance or testing on your main one
- Providing a layer of protection for a real server by allowing access only through designated Nginx servers
Following links have some nice explanation and description about proxy servers.