Proxy vs Reverse Proxy vs LoadBalancer

Intro

Reverse proxy servers and load balancers are components in a client-server computing architecture, and both act as intermediaries in the communication between the clients and servers, performing functions that improve efficiency. They can be implemented as dedicated, purpose-built devices, but increasingly in modern web architectures they are software applications that run on commodity hardware. A forward proxy, often called a proxy, proxy server, or web proxy, is a server that sits in front of a group of client machines. When those computers make requests to sites and services on the Internet, the proxy server intercepts those requests and then communicates with web servers on behalf of those clients, like a middleman.

The basic definitions are simple:
  • A Reverse Proxy accepts a request from a client, forwards it to a server that can fulfill it, and returns the server’s response to the client.
  • A Load Balancer distributes incoming client requests among a group of servers, in each case returning the response from the selected server to the appropriate client.
  • A Forward proxy sits in front of a client and ensures that no origin server ever communicates directly with that specific client.

  • Forward Proxy

    A "proxy" is a message-forwarding agent that is selected by the client, usually via local configuration rules, to receive requests for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations are minimal, such as for proxy requests for "http" URIs, whereas other requests might require translation to and from entirely different application-level protocols. Proxies are often used to group an organization's HTTP requests through a common intermediary for the sake of security, annotation services, or shared caching. Some proxies are designed to apply transformations to selected messages or payloads while they are being forwarded.

    The difference between a forward and reverse proxy is subtle but important. A simplified way to sum it up would be to say that a forward proxy sits in front of a client and ensures that no origin server ever communicates directly with that specific client. On the other hand, a reverse proxy sits in front of an origin server and ensures that no client ever communicates directly with that origin server.


    Reverse Proxy

    A Reverse Proxy (a.k.a. "Gateway") acts as an intermediary between a client and a server handling requests and responses, and acts as an origin server for the outbound connection but translates received requests and forwards them inbound to another server or servers. Gateways are often used to improve security by encapsulating legacy or untrusted information services, hide the origin server's IP address by creating a layer of abstraction between the client and the server, handle SSL/TLS encryption and decryption, which can improve server performance and simplify SSL certificate management, and to improve server performance through caching. Further to security and performance, a reverse proxy can enable partitioning or load balancing of HTTP services across multiple machines.

    Reverse proxies can be used with one or more servers, and as described are often used to improve security, caching, and perform load balancing with SSL termination. With a reverse proxy, when clients send requests to the origin server of a website, those requests are intercepted at the network edge by the reverse proxy server. The reverse proxy server will then send requests to and receive responses from the origin server.

    Reverse proxies, as well as load balancers, are both network components that improve website performance, but they have different purposes and operate at different layers of the network stack. A Reverse Proxy is specifically a Level 7 load balancer, dealing exclusively with web requests. On the other hand, a load balancer can operate on Levels 3-7 of the OSI model, handling numerous types of requests on top of web requests. (e.g., DNS, SSL, TCP.) However, while a load balancer can operate on additional layers besides Layer 7, a reverse proxy can perform additional roles to that of a load balancer.


    LoadBalancer

    Both a Reverse Proxy and LoadBalancer look the same when we try to understand them, as both promise to improve efficiency and sit in between client and server, however their functionality differs.

    The technical definition of Load balancing or a Load Balancer is hardware or a software unit that distributes the total load on a website by distributing it to multiple servers. Load balancing has a handful of algorithms which can be used, and the algorithms used by a load balancer should be chosen as such it makes the best use of each servers’ capacity and can provide the result as fast as possible. Some of these algorithms used by load balancers for distributing load can be IP Hash, Least connection, Round robin, Least traffic, Session Affinity, and others. LoadBalancers can also work on different layers of the OSI Model, including Layer 3/ Layer 4 (IP/TCP), Layer 7 (Application), and even DNS Round Robin.


    The choice between a reverse proxy and a load balancer depends on the specific needs of the application, such as performance, security, scalability, or handling high volumes of traffic


    Written: December 30, 2023