What Is a Reverse Proxy?
A reverse proxy is a server that sits between visitors and one or more backend servers, receiving all incoming requests and forwarding them to the right backend. Visitors only ever talk to the reverse proxy, which can add caching, HTTPS, load balancing and security before a request ever reaches the actual application.
Reverse proxy vs. forward proxy
A forward proxy sits in front of clients and hides them from the servers they contact, which is common for corporate networks or privacy tools. A reverse proxy does the opposite: it sits in front of servers and hides them from the clients making requests. Visitors to a website only ever see the reverse proxy's address, never the backend application server's real location.
What a reverse proxy does
- Routes requests: sends traffic to the correct backend based on the domain, path or server health.
- Terminates HTTPS: handles the TLS encryption and certificate once, so backend servers can communicate over plain HTTP internally.
- Caches responses: stores copies of pages or files so repeat requests are answered without hitting the backend again.
- Load balances: spreads requests across several backend servers to avoid overloading any one of them.
- Adds security: can block malicious requests, rate-limit abusive clients and hide backend server details and versions.
- Compresses and rewrites: can gzip responses or rewrite URLs before they reach the visitor.
A basic Nginx reverse proxy configuration
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
This configuration listens for public requests on port 80 and passes them to an application running locally on port 3000, forwarding useful headers so the backend still knows the original visitor's address and requested hostname.
Common reverse proxy software
| Software | Typical role |
|---|---|
| Nginx | Web server and reverse proxy, very common in front of application servers |
| HAProxy | Dedicated load balancing and proxying, popular for high-traffic setups |
| Apache (mod_proxy) | Reverse proxy features added to a traditional Apache install |
| Caddy | Simple configuration with automatic HTTPS |
| Cloudflare and similar CDNs | Reverse proxy at a global scale, often combined with caching and security |
Where reverse proxies show up in hosting
Many hosting setups place a reverse proxy, often Nginx, in front of the actual application runtime, whether that is PHP-FPM, Node.js or a Python app server. This is also how a single server can run several applications on different internal ports while visitors reach all of them over the standard web ports 80 and 443. A CDN is itself a globally distributed reverse proxy in front of your origin server.
Frequently asked questions
What is a reverse proxy in simple terms?
A reverse proxy is a server that receives requests on behalf of one or more backend servers and forwards each request to the right one, so visitors never contact the backend directly.
What is the difference between a reverse proxy and a load balancer?
A load balancer specifically spreads traffic across multiple backend servers to balance the load, while a reverse proxy is the broader category that can also cache, terminate HTTPS and add security even with only one backend. Many reverse proxies include load balancing as one of their features.
Why would a website need a reverse proxy?
Common reasons include running the web server and the application on different internal ports, adding HTTPS and caching in one place, hiding the real backend server from the internet, and spreading traffic across multiple servers.
Is a CDN a reverse proxy?
Yes, conceptually. A CDN places reverse proxy servers at many locations worldwide, each able to cache content and forward uncached requests back to the origin server.
Does a reverse proxy slow down a website?
A well-configured reverse proxy typically adds very little delay and often speeds things up overall through caching and connection handling. Poor configuration or an overloaded proxy server can add latency, so capacity and settings matter.
Can I set up a reverse proxy on a VPS myself?
Yes, software such as Nginx, HAProxy or Caddy can be installed on a VPS and configured to proxy requests to one or more backend applications running on the same or different servers.
Related topics
- What Is an SSL Certificate? Security & SSL
- What Is a Load Balancer? Web Servers
- What Is Port 80? Networking & IP
- What Is Nginx? Web Servers
- What Is a Web Server? Web Servers