Reverse Proxy

A reverse proxy is a server that sits in front of web servers, receives client requests and forwards them to the right backend on their behalf.

Summarize this

What is a reverse proxy?

A reverse proxy is a server placed between users and one or more backend servers. Visitors send their requests to the proxy, which forwards each one to the appropriate server and returns the response as if it came from a single origin. The client never talks directly to the application servers, which stay hidden behind it.

How a reverse proxy works

The flow has four steps: the browser resolves the domain through DNS to the proxy's address, the proxy receives the request, it picks a backend based on rules (path, host, headers, load), and it relays the response back, sometimes after modifying it. A minimal Nginx configuration looks like this:

server { listen 443 ssl; server_name example.com; location /api/ { proxy_pass http://127.0.0.1:3000; } }

Here, every request to /api/ is passed to an application listening on port 3000, while the rest of the site can be served from elsewhere.

What a reverse proxy is used for

  • Load balancing: spreading traffic across several servers to avoid overload (see load balancing).
  • TLS termination: handling HTTPS and the SSL certificate in one place instead of on every server.
  • Caching and compression: serving frequent responses without hitting the backend.
  • Security: hiding internal servers, filtering malicious requests and applying rate limiting.
  • Routing: exposing several services, for example microservices, under one domain.

Reverse proxy vs forward proxy vs CDN

AspectReverse proxyForward proxyCDN
Acts on behalf ofThe serversThe clientsThe servers, at the edge
Typical positionIn front of the backendIn front of users or a company networkDistributed across many locations
Main goalRouting, security, performanceAnonymity, filtering, access controlFast delivery close to the user
ExamplesNginx, HAProxy, TraefikCorporate web gatewayCloudflare, Fastly

A CDN is in practice a network of reverse proxies spread around the world, which is why the two notions overlap.

Best practices and pitfalls

  • Forward the original client IP with headers such as X-Forwarded-For, otherwise the backend only sees the proxy.
  • Set sensible timeouts and health checks so a failing server is removed from rotation.
  • Keep security HTTP headers consistent at the proxy level.
  • Avoid making the proxy a single point of failure: run at least two instances for critical apps.

Reverse proxy and SEO

A reverse proxy can serve a blog or an app under a subfolder of the main domain instead of a subdomain, which keeps authority consolidated on one host. It must preserve canonical URLs, status codes and headers, or search engines may index the wrong address.

Reverse proxy at BeBranded

On our web app projects, we put a reverse proxy or an edge layer in front of the application to handle HTTPS, caching and routing, so the product stays fast and secure as traffic grows. Discover our web apps service.

FAQ

A reverse proxy is a server in front of one or more backend servers. It receives client requests, forwards them to the right server and returns the response.
A forward proxy acts for the clients and hides their identity. A reverse proxy acts for the servers and hides the backend infrastructure.
A load balancer distributes traffic across servers. A reverse proxy does this too, but also handles caching, TLS, routing and security. Many reverse proxies include load balancing.
In practice yes. A CDN is a network of reverse proxies placed close to users, which cache and deliver content from the edge.
Common choices are Nginx, HAProxy, Traefik and Caddy, as well as managed services such as Cloudflare.
Yes. It hides internal servers, terminates TLS, filters malicious requests and can apply rate limiting, but it must itself be kept up to date and configured correctly.

Ready to boost your conversions?

Our team is here to understand your needs & work with you to create your next projects.
Get news, infos and resources.
Actionable tips delivered straight to your inbox.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.