A reverse proxy is a server or load balancer that sits between client devices (such as web browsers or APIs) and a web server, forwarding client requests onward and then returning the server's responses to the clients. 

This intermediary between users and web servers works on behalf of the servers and not on behalf of the clients like a forward proxy would. It ensures that no client can communicate directly with a backend server.

How does a reverse proxy work?

A reverse proxy works in the following way:

  1. A client sends a request while attempting to access a web app or API. The reverse proxy receives this request. 

  2. The reverse proxy forwards that request to the appropriate web server. 

    • A reverse proxy will often filter out invalid or harmful requests, forwarding only legitimate requests.

    • A reverse proxy functioning as a load balancer will determine the appropriate web server using load balancing algorithms and health checks.

  3. The web server processes the request and generates a response. 

  4. The reverse proxy receives this server response and forwards it to the client. The server can bypass the proxy, however, when direct server return is enabled.

Why are reverse proxies useful?

A reverse proxy provides numerous performance, security, and scalability enhancements for web applications and APIs. These can include the following:

  • Load balancing – Reverse proxies that also function as load balancers can distribute incoming requests (sometimes millions per second) across multiple servers to prevent any one web server from getting overwhelmed. When a server degrades or fails, the proxy will send traffic to another working server to prevent service disruptions. 

  • Filtering & firewall protection – Reverse proxies often ship with customizable rulesets, weights, measures, and Web Application Firewall (WAF) implementations to stop malicious traffic and abuse. 

  • Caching – Reverse proxies can store copies of server responses and quickly serve them to clients without forwarding redundant server requests.

  • SSL termination – Proxies can handle SSL/TLS encryption and decryption, a resource-intensive task that'd otherwise be left to the web server.

You’ve mastered one topic, but why stop there?

Our blog delivers the expert insights, industry analysis, and helpful tips you need to build resilient, high-performance services.

Thank you! Your submission was successful.

Does HAProxy offer reverse proxying?

Yes! Reverse proxying is core to the HAProxy One application delivery platform. Accordingly, HAProxy Enterprise load balancer sits in front of your application servers as a high-performance reverse proxy, routing each client request to the right backend and filtering malicious traffic before it reaches your infrastructure. Teams running many instances can manage them centrally with HAProxy Fusion.

Explore our load balancing solutions to learn how HAProxy routes and protects traffic at scale.