Skip to main content
A reverse proxy is a web server that centralizes internal services and provides unified interfaces to the public. Requests from clients are forwarded to a server that can fulfill it before the reverse proxy returns the server’s response to the client. Reverse Proxy

Benefits

Additional benefits include:
  • Increased security - Hide information about backend servers, blacklist IPs, limit number of connections per client
  • Increased scalability and flexibility - Clients only see the reverse proxy’s IP, allowing you to scale servers or change their configuration
  • SSL termination - Decrypt incoming requests and encrypt server responses so backend servers do not have to perform these potentially expensive operations
  • Compression - Compress server responses
  • Caching - Return the response for cached requests
  • Static content - Serve static content directly
    • HTML/CSS/JS
    • Photos
    • Videos
    • Etc

Load Balancer vs Reverse Proxy

When to Use Each

  • Load Balancer: Deploying a load balancer is useful when you have multiple servers. Often, load balancers route traffic to a set of servers serving the same function.
  • Reverse Proxy: Reverse proxies can be useful even with just one web server or application server, opening up the benefits described in the previous section.
  • Both: Solutions such as NGINX and HAProxy can support both layer 7 reverse proxying and load balancing.
A reverse proxy can be beneficial even with a single backend server, while load balancers are specifically designed for distributing traffic across multiple servers.

Key Differences

AspectLoad BalancerReverse Proxy
Primary PurposeDistribute traffic across multiple serversCentralize and manage access to backend services
Minimum ServersMultiple serversCan work with single server
Use CaseHigh availability and horizontal scalingSecurity, caching, SSL termination, serving static content
  • Introducing a reverse proxy results in increased complexity.
  • A single reverse proxy is a single point of failure, configuring multiple reverse proxies (ie a failover) further increases complexity.

Source(s) and Further Reading

Build docs developers (and LLMs) love