Networking & DNS

Forward proxy vs reverse proxy vs load balancer

The difference between a forward proxy, a reverse proxy and a load balancer, what each is used for, real examples like Squid, Nginx, HAProxy and Cloudflare, and how they combine.

BeginnerServers and networking3 min read

Forward proxy vs reverse proxy is a question of whose side the proxy is on. A forward proxy acts for clients reaching out to the internet; a reverse proxy acts for servers receiving traffic. A load balancer is a reverse proxy that spreads traffic across several servers. This guide explains all three with real examples.

Before you start

It helps to know that a proxy is simply an intermediary: it receives a request, maybe changes or checks it, and forwards it somewhere else.

Forward proxy

A forward proxy sits in front of clients. Browsers in an office or school send requests to the proxy, which fetches pages from the internet on their behalf.

  • Uses: content filtering, caching shared downloads, logging, controlling outbound access, hiding internal IPs.
  • Examples: Squid, corporate secure web gateways, SOCKS proxies such as an SSH SOCKS tunnel.
  • Who knows about it: clients must be configured to use it (or traffic is intercepted transparently).

Reverse proxy

A reverse proxy sits in front of servers. Visitors think they are talking to your website, but the proxy receives the request and passes it to the real server behind it.

  • Uses: TLS termination, caching, compression, serving static files, routing domains or paths to different apps, hiding backend servers, WAF and DDoS filtering.
  • Examples: Nginx in front of Node.js, LiteSpeed in front of PHP apps, Cloudflare in front of your origin server.
  • Who knows about it: visitors usually do not; the backend sees the proxy's IP unless it reads headers like X-Forwarded-For.

Load balancer

A load balancer is a reverse proxy with several backends. It decides which server gets each request (round robin, least connections, IP hash) and stops sending traffic to backends that fail health checks.

  • Uses: scaling beyond one server, high availability, zero-downtime deployments.
  • Examples: HAProxy, Nginx upstreams, cloud load balancers.

Side-by-side comparison

Forward proxyReverse proxyLoad balancer
Acts forClientsServersServers
BackendsThe whole internetOne or moreSeveral
Main goalsControl and privacy of outbound trafficSecurity, TLS, caching, routingScale and availability
Typical softwareSquidNginx, LiteSpeed, Caddy, CloudflareHAProxy, Nginx

How they combine in real hosting

A typical busy site might look like: visitor → Cloudflare (reverse proxy/CDN) → HAProxy (load balancer) → several web servers running LiteSpeed or Nginx → application server → database. Each layer is a reverse proxy for the next.

Getting real visitor IPs behind a proxy

Because the backend sees the proxy's address, configure it to trust headers from the proxy only: for example X-Forwarded-For or Cloudflare's CF-Connecting-IP. Never trust these headers from arbitrary clients, or attackers can spoof their IP.

FAQ: forward proxy vs reverse proxy

Is a VPN a forward proxy?

Similar in purpose, but a VPN tunnels all network traffic at the network layer, while a proxy usually handles specific protocols. See the proxy vs VPN guide.

Is Cloudflare a reverse proxy?

Yes, when the orange cloud is enabled, Cloudflare proxies requests to your origin server.

Do I need a load balancer for one server?

No. A reverse proxy is enough until you need more than one backend.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.