Skip to main content

Command Palette

Search for a command to run...

Proxy - A complete beginner's guide

Updated
4 min readView as Markdown
Proxy - A complete beginner's guide

Introduction

You guys might have often heard these terms proxy and VPN and often might have used them but ever wondered how they are working behind the scenes. Chill then this the right place to envision the working and i will be guiding you the step by step working and how it can be implemented and where it can be used in the real world scenarios.

Proxy

Proxy are nothing but a middleman who will be masking your IP address and provides you an anonymity in this social network. When a client hits a request to proxy instead of directly hitting the server here the proxy acts as a middleman and proxy first processes the client’s request and forward it to the respective server, now the server will have the idea of the proxy’s ip as the origin ip for that request and have no idea of how and where these network request came through.

Real world scenario

Think of you are now planning to donate some amount to the poor peoples but you are not willing to reveal your identity either. So you are planning to give all the money to your friend to buy some food and clothes and asking him to give those to the people who are in need. So now the data i.e. the food and clothes that you need to send it to the server , here the poor people has reached them without revealing the client’s IP or the personal details of him.

Use cases

Now you have a basic idea of what proxy does and how proxies are working. Now if you think of proxy can only mask the IP then you’re in a right track to get an idea about the use cases where this can be incorporated

Heard the term load balancing and multiplexing? Yes its nothing but balancing the network traffic to multiple servers. Instead of hitting the api calls directly to the end server the api calls will be landed to the proxy machines. These proxy servers have a dedicated purpose to monitor how many servers are present how many servers are currently handling requests and how many servers are free and to which server I can forward this request. Proxy basically multiplexes the request and acts as a multiplexer here.

That’s it? Nahh Buddy. Proxy can do more. Proxies can acts as your caching buddy. Heard the term edge server? Think of your Data Centre located in New York and you sits somewhere in the middle of the Bangalore traffic in your car reading this blog post. The first time you hit the call it will be landing to the New York and all the data will be fetched and stored it in a edge server which will be somewhere located in India, say Mumbai. Now your further calls of the same static files are landed to this server and now BOOM your latency is reduced drastically. This CDN in edge server follows the proxy mechanism.

Reverse Proxy

Now that you have mastered proxy its easier to understand reverse proxy as well. A forward proxy represents the client and hides its identity from the server. A reverse proxy represents the server and hides server details from the client while also handling load balancing, caching, and security. But in reverse proxy it waits for the response from the server and forwards the response back to the client as a complete middle man.

Real world scenario

Think of you are entering into a hotel room. Now you need to book a premium rooms for stay tonight and you are asking to the receptionist, the receptionist will check with the manager for any premium suite rooms available and will get back to you. This to and fro communications are handled by the receptionist and here the instructions / data are not transferred only in the forward directions to manager alone but in reverse as well.

Analogy

Hurrayyy!!! You have mastered both the forward and reverse proxy. All the advantages of proxy are leveraged by the reverse proxy setup as well, the only extra advantage is that it will forward back the request to client.

TL;DR

Proxies are like a one way streamed pipeline which transfers the data from the client to the server and acts as a middleman who masks the identity of the client whereas in reverse proxy it will share the response from server back to the client which is very useful in caching , load balancing etc which are used by the Cloud Flare’s edge server.

What’s More

Congratulate yourself for making this far!!!.Everyone might have heard the term VPN and it would make you anonymous over the internet then why proxies. Yes you’re right VPN’s are advanced mechanisms of proxy similar to proxies there will be a middleman but unlike proxy here the private connections are made as a tunnel with end to end encryption provided there by providing more security towards the data shared. If you are interested more in these kinds of information drop them in comment so that I will write it as a blog post in a detailed manner.