System Design Building Blocks: Forward and Reverse Proxy

Proxy servers act as mediators for clients and servers, are used for caching and security. They are divided into forward proxy and reverse proxy.

Proxy servers are intermediaries between clients and servers. They can be used for various purposes, such as caching, filtering, load balancing, and improving security. Proxies receive requests from the clients and forward them further.

There are two types of proxies – forward and reverse.

Forward proxy

  • client-side proxy
  • sits in front of client machines and forwards requests to the internet
  • proxy server intercepts requests from clients and on their behalf forwards them to the internet.

Advantages of using a forward proxy

  • improved security – hides the client’s IP address
  • blocks access to certain websites
  • can modify requests and responses preventing from sharing sensitive information
Forward proxy between clients and the internet

Forward proxy vs firewall

  • firewall is a network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules
  • firewall protects whole internal network from malicious traffic
  • forward proxy only mediates the communication between the client and the internet
  • forward proxy makes users anonymous, firewall doesn’t.

Reverse Proxy

  • web server that sits in front of web servers and forwards client requests to those servers
  • provides unified interface to clients.

Benefits of using a reverse proxy

  • improved security – hides the origin server
  • improved performance – can cache static content, compress data, and offload SSL
  • load balancing – distributes incoming network traffic across multiple servers
  • allows to easily change backend servers without affecting clients.
Reverse proxy in front of origin servers

Load balancer vs reverse proxy

  • load balancer distributes incoming network traffic across multiple servers
  • reverse proxy can forward request to a single server or multiple servers
  • a reverse proxy can act as a load balancer but not the other way around.

Forward proxy vs reverse proxy

  • forward proxy makes sure that the origin server doesn’t communicate directly with the client
  • reverse proxy makes sure that the client doesn’t communicate directly with the origin server
  • reverse proxy protects servers, forward proxy protects clients.

This article is a part of a System Design Course, to learn more about it visit System Design Roadmap.

Share this article!