Forward & Reverse Proxies
What is a Proxy? Difference between forward and reverse proxies? Find out if reverse proxies and load balancers are exactly the same thing? Common types of proxy technologies used
What is a Proxy?
In systems design, a proxy server is a component that acts as an intermediary between a client (user or computer) and another server (such as the website or application). It receives requests from the client and then forwards them to the servers. Proxies are used for filtering content, log request and sometimes for extra security (like adding/removing headers, encrypting/decrypting and even compression)
Types of proxies
Forward Proxy
A forward proxy also known as as a web proxy or simple a proxy, is a type of proxy server that sits between a client and the internet. When a client makes a request to access a website or other internet resource, the request is first sent to the forward proxy server. The forward proxy server then relays the request to the internet on behalf of the client, and returns the response from the requested server back to the client acting like a middleman.
Benefits of forward proxies:
Provides a level of anonymity by hiding IP address from the internet.
Used to cache frequently accessed content to improve performance
Used to restrict access to certain sites/content
Reverse Proxy
A reverse proxy is a server that sits between one or more servers and the internet, acting as an intermediary for incoming client requests. Unlike a forward proxy, which is used by clients to access the internet, a reverse proxy is used by web servers to handle requests from clients on their behalf.
The difference between a reverse proxy and forward one is very subtle but crucial. A simple way to differentiate them is that a forward proxy sits in front of a client and ensures no origin server communicates directly with the client. Whereas, a reverse proxy sits in front of an origin server and ensures that no client ever communicates directly with the origin server.
Reverse proxies introduce complexities but their benefits in computing are great.
Benefits of reverse proxies:
Load balancing
Content caching
SSL encryption & termination
Improved security
Scalability, flexibility & performance
How do reverse proxies compare to load balancers?
A load balancer is a type of reverse proxy which distributed requests across multiple web servers.
Reverse proxies generally forward traffic to a single server, while load balancers distribute traffic to multiple servers. Reverse proxies are commonly used to hide the identity of the server from the client, while load balancers are used to distribute traffic across a pool of servers.
Load balancers are really handy when you have multiple server. Generally, load balancers route traffic to a set of servers doing the same thing. Whereas, reverse proxies can be even handy with just one web server.
Some commonly used proxy technologies:
Nginx
Traefik
HAProxy
Envoy
🗞️ Follow our weekly newsletter for homemade content on software, systems, software engineering, career advice, and job opportunities. 💡 Follow me on LinkedIn for more.
💬 Drop a comment below if you have any questions or suggestions for future topics!
Follow our LinkedIn page CoderCo too!