Proxy
An intermediary server that sits between the client and the destination server. Forward proxies act on behalf of clients; reverse proxies act on behalf of servers.
What is Proxy?
In short
A proxy is an intermediary server that sits between a client and a destination server, forwarding requests and responses on behalf of one side or the other. A forward proxy acts for the client and hides who is making the request; a reverse proxy acts for the server and hides which backend actually handles it.
What a proxy actually is
A proxy is a server that relays traffic between two endpoints instead of letting them talk directly. The client sends its request to the proxy, the proxy decides what to do with it, and then it talks to the real destination. The response comes back the same way, in reverse.
There are two flavors, and the difference is whose side the proxy is on. A forward proxy sits in front of clients. When 5,000 employees in an office browse the web through one proxy, the websites they visit only see the proxy's IP address, not each employee's machine. A reverse proxy sits in front of servers. When you load a large website, you are almost always hitting a reverse proxy first, and it routes your request to one of many backend servers behind it.
The key idea is indirection. Because every request flows through one controlled point, the proxy can inspect, cache, block, rewrite, encrypt, or count traffic before passing it along. Neither the client nor the server has to know the other one exists directly.
How it works under the hood
At the network level, a proxy terminates the incoming connection and opens a new one to the target. For HTTP, a reverse proxy reads the request line and headers, looks at fields like Host and the URL path, and uses rules to pick a backend. Nginx, for example, matches the request against location blocks and forwards it to an upstream group, often round-robin across several servers.
Forward proxies often work through explicit client configuration. Your browser or operating system is told to send all traffic to proxy.example.com on port 3128, and it uses the HTTP CONNECT method to tunnel HTTPS traffic. The proxy can then allow or deny destinations by domain.
Reverse proxies add real work on the request path: they terminate TLS so backends do not each need certificates, they cache responses so identical requests never reach the origin, they compress responses with gzip or brotli, and they add headers like X-Forwarded-For so the backend still knows the original client IP. Because the proxy is the single front door, it is also the natural place to enforce rate limits and block bad requests.
When to use one and the trade-offs
Use a forward proxy when you need to control or anonymize outbound traffic: corporate filtering, content blocking, hiding client identity, or caching shared downloads for a whole office. Use a reverse proxy when you run servers and want a single, controllable entry point for TLS termination, load distribution, caching, and security filtering.
The cost is that a proxy is one more hop, so it adds a little latency, and if it goes down without a backup it takes everything with it. That is why production reverse proxies run in pairs or pools behind a health check or a load balancer.
People often confuse a reverse proxy with a load balancer. They overlap: a load balancer's main job is spreading traffic across servers, while a reverse proxy's broader job includes caching, TLS, header rewriting, and routing by URL. Many tools like Nginx and HAProxy do both, which is why the line is blurry.
A concrete example
Imagine an online store running on ten identical application servers. You put Nginx in front as a reverse proxy on port 443. A shopper's browser connects to the store, Nginx terminates the HTTPS connection, and then forwards the plain HTTP request to whichever app server is least busy.
If the request is for the homepage image or a product photo, Nginx serves it straight from its own cache and the app servers never see it. If it is a checkout request, Nginx adds X-Forwarded-For so the app knows the real customer IP, applies a rate limit so one bot cannot hammer checkout, and passes it through.
From the shopper's side there is one address and one certificate. Behind the proxy you can add, remove, or restart app servers at any time, and the shopper never notices. That single point of control is the entire reason proxies are everywhere in modern infrastructure.
Where it is used in production
Nginx
Used as a reverse proxy in front of application servers for TLS termination, caching, and load distribution across backends.
Cloudflare
Acts as a global reverse proxy in front of millions of sites, caching content and filtering attacks before requests reach the origin.
HAProxy
A high-performance reverse proxy and load balancer used by companies like GitHub and Reddit to route and balance HTTP and TCP traffic.
Squid
A classic forward proxy used in corporate and ISP networks to cache web content and filter or control outbound browsing.
Frequently asked questions
- What is the difference between a forward proxy and a reverse proxy?
- A forward proxy sits in front of clients and acts on their behalf, hiding who is making the request from the destination. A reverse proxy sits in front of servers and acts on their behalf, hiding which backend actually handled the request from the client.
- Is a reverse proxy the same as a load balancer?
- Not exactly. A load balancer's main job is spreading traffic across multiple servers. A reverse proxy does that too but also handles TLS termination, caching, compression, and routing by URL. Tools like Nginx and HAProxy do both, which is why the terms get mixed up.
- Does a proxy slow things down?
- It adds one extra network hop, so there is a small latency cost. In practice a reverse proxy often makes things faster overall by caching responses, reusing connections to backends, and offloading TLS work, which outweighs the extra hop.
- Is a VPN a type of proxy?
- They are related but not identical. A proxy usually routes one application or protocol, like web traffic, and works at the HTTP or TCP level. A VPN encrypts and routes all traffic from your device at the network level. A VPN gives broader, lower-level tunneling than a typical proxy.
- How does a backend server know the real client IP behind a proxy?
- The proxy adds a header, most commonly X-Forwarded-For, that carries the original client IP. The backend reads that header instead of the proxy's own connection address. You must trust only your own proxies for this, since clients can forge the header.
Learn Proxy hands-on
This page explains the idea. The full lesson lets you step through the ring as servers join and leave, read the implementation, and check yourself with a quiz. It is one of 760+ lessons in the System Design Masterclass, from your first API call to distributed consensus. Eleven Foundation lessons are free, no signup. Lifetime access is ₹499 in India or $7.99 worldwide, one payment, no subscription.
Related lessons
Lessons that touch on Proxy as part of a larger topic.
Forward Proxy
A middleman that sits between clients and the internet, hiding who's asking
foundation · load balancing proxies
Reverse Proxy
A middleman that sits in front of servers, hiding what's behind it
foundation · load balancing proxies
Ambassador Container Pattern
A specialized sidecar that handles outbound connectivity, connection pooling, retries, and protocol translation for external services
intermediate · microservices architecture
Proxy Pattern
Control access to an object by placing a surrogate in front of it, caching, security, and lazy loading in one pattern
intermediate · microservices architecture
Server-Side Caching
Caching at the server and infrastructure level, reverse proxies, CDNs, and full-page caching
foundation · caching strategies
See also
Related glossary terms you might want to look up next.
Reverse Proxy
A server that sits in front of your backend servers and forwards client requests to them. Handles SSL termination, caching, and load balancing.
Load Balancer
Distributes incoming traffic across multiple servers so no single server gets overwhelmed. Like a traffic cop directing cars to different lanes.
API Gateway
A single entry point for all client requests that routes them to the appropriate microservice. Handles auth, rate limiting, and request transformation.
DNS
The phonebook of the internet. Translates human-readable domain names (google.com) into IP addresses that computers understand.
DNS Record Types
Different types of DNS records map domains to resources: A records point to IPs, CNAME aliases one domain to another, MX routes email, TXT stores verification data.
Forward Proxy
A proxy that sits in front of clients and forwards their requests to the internet. Used for anonymity, content filtering, and bypassing geo-restrictions.