← Glossary

What Is a Reverse Proxy?

A reverse proxy is a server-side intermediary that accepts client requests as if it were the origin, then forwards them to one or more backend servers, commonly adding TLS termination, caching and load balancing along the way.

Updated:

A reverse proxy is a server that sits in front of one or more origin servers and accepts requests on their behalf. To the browser or API client, the reverse proxy looks like the website itself: it serves the public endpoint and, in a common HTTPS deployment, presents its certificate and returns responses. It can forward a request to a backend and relay the answer, or respond from a cache or local policy. The HTTP specification, RFC 9110, calls this role a gateway and defines it as an intermediary that acts as an origin server for the outbound connection while translating and forwarding requests inbound to other servers.

The defining feature is who deploys it and whom it serves. A reverse proxy server is operated by the site owner or a provider acting for the site to protect, scale or reorganize their own infrastructure. That places it at the opposite end of the connection from a forward proxy, which a client chooses in order to reach the wider Internet. Products such as nginx, HAProxy, Apache with mod_proxy, Envoy and the edge networks of CDN providers all perform this function.

Client, Proxy and Origin Request Flow

A typical HTTP reverse proxy receives the client's connection at the site's public endpoint. For HTTPS it commonly terminates TLS, then chooses an upstream server according to host, path or other configuration. It may reuse an upstream connection rather than open one per request. In nginx, proxy_pass identifies the upstream address and scheme. The proxy relays the response, possibly applying caching or header changes. Client and upstream protocol versions can differ, including HTTP/3 on the client side.

Because the proxy terminates the client's connection, the origin normally sees the proxy's address at the transport layer. To preserve the visitor's address, proxies add request headers. RFC 7239 defines the standardized Forwarded header with for, by, host and proto parameters, while the older X-Forwarded-For header remains the de facto convention and lists the originating client followed by each proxy in the chain. The Via header records forwarding information. RFC 9110 requires it from HTTP forward proxies; gateway requirements differ, so absence of Via does not establish that no reverse proxy exists.

These headers are only as trustworthy as the chain that produced them. Any client can send an X-Forwarded-For header of its own, so an origin should accept the value only when the request demonstrably arrived from an explicitly trusted proxy, and should strip or overwrite client-supplied copies at the edge. Using an unverified forwarded address for access control or rate limiting opens the door to bypasses.

TLS Termination, Caching and Load Balancing

A reverse proxy can combine several shared services even when only one application server sits behind it.

TLS termination

The proxy holds the certificate and private key for the public hostname and performs the TLS handshake with the client. Traffic toward the origin can then travel either as plain HTTP across a private network or as a second TLS connection. nginx, for example, can forward to an https upstream and optionally verify the upstream certificate, although that verification is off by default and has to be switched on. Where the connection is re-encrypted, the arrangement is often called TLS bridging; where it is not, the unencrypted segment remains visible to parties able to observe that network path.

Caching

A reverse proxy can store responses and serve repeat requests without contacting the origin. RFC 9110 lists accelerator caching among the common reasons for deploying a gateway. Cache keys, validity periods and bypass rules are set in the proxy configuration, and shared-cache rules and the origin's Cache-Control instructions should guide what is stored; overrides need particular care. Caching reduces backend load for static assets and for pages that change infrequently, but it also means a stale object can be served until it expires or is purged.

Load balancing

When several identical origins exist, the proxy distributes requests among them. The simplest method is round-robin, which nginx applies automatically when an upstream hostname resolves to several addresses. More elaborate load balancers add health checks that remove an unresponsive origin from rotation, weighted distribution, session affinity and geographic steering. Cloudflare's load balancing documentation, for instance, describes monitoring endpoints from multiple data centers and shifting traffic away from unhealthy ones. The client need not select the origin, although response details may reveal which backend handled a request.

Reverse Proxies vs Forward Proxies

Both devices forward HTTP, both can cache and both can modify headers, which is why the terms are often confused. The difference is direction and ownership.

PropertyForward proxyReverse proxy
Who configures itThe client or the client's network administratorThe operator of the destination site
What it hidesCan substitute its own network address; headers may still disclose the clientCan keep origins off the public request path; concealment is not guaranteed
How it is reachedExplicit proxy settings or interceptionPublic DNS for the site's own hostname
Typical purposesAccess control, egress filtering, changing the visible source IPTLS termination, caching, load balancing, filtering inbound traffic
RFC 9110 termProxyGateway

A corporate outbound web filter is a forward proxy; a website's shared public entry point is a reverse proxy. The same software can implement either role, but client-directed access and server-side routing remain different responsibilities.

A reverse proxy only mediates traffic for the sites it fronts. It does not change the visitor's outbound address on unrelated websites; that is a different routing problem.

Common Deployment Patterns

Path-based routing sends /api requests to one backend and everything else to a static file server, letting a single hostname front several services. Protocol translation lets a proxy speak HTTP/2 or HTTP/3 to browsers while talking HTTP/1.1 to legacy applications. Request filtering at the edge drops malformed requests, enforces size limits and applies rate limits before the origin spends resources. Compression, response header normalization and the injection of security headers are often centralized at the proxy so that individual applications do not each need to implement them.

CDN edge networks are reverse proxies at global scale. A visitor connects to a nearby edge node, which terminates TLS, serves cached content where possible and forwards the rest to the customer's origin. Cloudflare's documentation shows the result from the origin's perspective: incoming requests carry headers such as CF-Connecting-IP with the visitor's address and X-Forwarded-Proto with the scheme the visitor used, while the TCP source address belongs to the edge.

Limitations and Considerations

A reverse proxy adds a hop, and every hop costs latency, a possible point of failure and another system to patch. If the proxy is misconfigured, it can leak internal hostnames in redirects, expose backend error pages or forward hop-by-hop headers it should have removed. Forwarded client addresses are trustworthy only under a defined chain of trust. Origins commonly restrict direct access; any permitted direct request must not gain authority from a client-supplied forwarding header.

TLS termination at the proxy means the proxy holds plaintext. Operators must decide whether the network between proxy and origin is trustworthy enough to carry unencrypted traffic, or accept the overhead of re-encryption with certificate verification enabled. Caching can serve outdated or, if keys are badly chosen, another user's personalized content. Load balancing improves availability only when health checks are meaningful and the origins are actually independent. None of these services make an application secure on their own; they move certain responsibilities to a shared layer where they can be managed consistently.

Frequently asked questions

Does a reverse proxy hide the visitor's IP?

A connection-terminating proxy normally replaces the transport source address seen by the origin, but it can pass the visitor's address through trusted forwarding metadata. That is not a privacy guarantee for the visitor. A site's reverse proxy does not change the address other sites see when the visitor browses elsewhere.

Is a load balancer always a reverse proxy?

No. An HTTP load balancer that terminates connections and forwards requests is a reverse proxy, but DNS-based load balancing simply returns different addresses to different clients, and some layer-4 balancers pass TCP connections through without acting as an HTTP endpoint. The terms overlap without being identical.

Where can TLS terminate?

At the reverse proxy, at the origin, or at both. Terminating at the proxy centralizes certificates and lets the backend segment run plain HTTP on a private network. Re-encrypting toward the origin adds protection for that segment, but only if the proxy is configured to verify the origin certificate.

Can clients tell a reverse proxy is in use?

Sometimes. Response headers such as Via, Server or vendor-specific identifiers can reveal an intermediary, and the certificate or IP ranges may belong to a known CDN. A well-configured deployment can suppress most of these signals, but concealment is not the purpose of a reverse proxy.

Why trust X-Forwarded-For only from known proxies?

Clients can supply that header themselves. A server must know which hops are trusted and derive the address according to that deployment's chain, rather than blindly accepting the first value. This can include a trusted third-party CDN; ownership of the proxy is less important than authenticated, controlled handling of the metadata.