Two servers can run the exact same software, say Nginx or Squid, and one is a forward proxy while the other is a reverse proxy. The code isn't what separates them. The side they work for is.
A forward proxy acts for the people sending requests. A reverse proxy acts for the servers answering them. Mix those up and you'll buy residential IPs when you needed Caddy, or open your app to the internet when you meant to hide it. (If your real question is proxy or VPN, that's a different split, covered in my proxy vs VPN comparison.)
The short answer: a forward proxy hides or controls clients, and a reverse proxy hides and protects servers.
Below is how each one works, where you meet them every day, and a working reverse proxy config you can copy onto a VPS. Every behaviour here comes from the Nginx, Caddy, Cloudflare and MDN documentation. Some links are affiliate links; they don't change your price.

What is a forward proxy?
A forward proxy is a server that sits in front of client devices and sends their requests to the internet on their behalf. The website you visit sees the proxy's IP address, not yours.
Cloudflare's learning centre describes it with three machines: your computer, the proxy, and the website's origin server. Without the proxy, your computer talks to the origin directly. With it, your computer talks only to the proxy, and the proxy talks to the origin.
People use forward proxies for three broad reasons, per Cloudflare and MDN:
- Privacy: the destination sees the proxy's IP, so your own address stays out of its logs
- Control: a school or office routes all traffic through one proxy and blocks sites it doesn't allow
- Access: getting to content from a different network or location than your own
The client always knows the proxy exists. You type its host and port into a browser, an app, a scraper or the operating system, or your company pushes it to you with a PAC file. If you've ever followed a guide to set up a proxy in Chrome, Firefox or Windows, you configured a forward proxy.
Every commercial proxy you can buy is a forward proxy. That includes datacenter proxies that route through cloud IPs, residential and mobile proxies, whether they speak HTTP or SOCKS5. Squid, the long-running open-source cache, is the classic self-hosted one.
What is a reverse proxy?
A reverse proxy is a server that sits in front of one or more web servers and receives every request meant for them. It forwards each request to the right backend, collects the answer, and returns it to the visitor.
Cloudflare puts the difference in one line: a forward proxy makes sure no origin server talks directly to a specific client, and a reverse proxy makes sure no client talks directly to the origin server.
The visitor usually has no idea it's there. They type your domain, the DNS points at the reverse proxy, and the proxy decides what happens next. MDN sums it up: forward proxies can hide the identities of clients, and reverse proxies can hide the identities of servers.
You use reverse proxies all day without seeing them. Cloudflare's CDN is one. So is the load balancer in front of most large sites, and the Nginx or Caddy instance in front of almost every self-hosted app.
Forward vs reverse proxy: what's the real difference?
The one question that settles it: whose side is the proxy on?

| Forward proxy | Reverse proxy | |
|---|---|---|
| Works for | Clients (users, apps, scrapers) | Servers (websites, APIs, apps) |
| Who configures it | The client side | The site owner |
| Who knows it exists | The client | Usually nobody outside |
| Hides | The client's IP | The origin server's IP |
| Typical jobs | Privacy, filtering, changing your exit IP | TLS, routing, load balancing, caching |
| Common tools | Squid, commercial proxy networks | Nginx, Caddy, HAProxy, Traefik, Cloudflare |
Here's the part most explanations skip. The request still travels the same way in both cases: from a client towards a server. "Reverse" doesn't mean the traffic runs backwards. It means the proxy faces the other way, guarding the destination instead of the source.
That's also why the same software can play both roles. Squid's own site calls it a caching proxy for the web and a server accelerator, which is reverse-proxy work. Nginx is mostly used as a reverse proxy, but the role comes from where you put it and who points at it.
What does a reverse proxy actually do for your site?
On a real server it does five jobs, all listed in Cloudflare's and MDN's documentation:
- TLS termination: it handles HTTPS certificates and encryption so your apps can speak plain HTTP on a private port
- Routing: one public IP, many apps, picked by domain or path (app.example.com goes to one container, n8n.example.com to another)
- Load balancing: it spreads requests across several copies of an app and stops sending traffic to one that fails
- Caching and compression: it stores static files and compresses responses so the backend does less work
- Hiding the origin: visitors only ever see the proxy, so the backend's real address and ports stay private

For a self-hoster, routing and TLS are the big two. Without a reverse proxy, every app needs its own public port and its own certificate setup. With one, you open ports 80 and 443 once and add a line per app.
My take: if you run more than one app on a VPS, a reverse proxy isn't optional. It's the front door.
How do you set up Caddy as a reverse proxy?
Caddy is the easiest way to get a reverse proxy with HTTPS. According to Caddy's reverse proxy quick-start, it fetches and renews a publicly trusted certificate automatically when you give it a domain name, as long as the DNS record points at your server and ports 80 and 443 are open.
Say your app listens on port 9000 on the same machine. The whole Caddyfile is this:
Reload Caddy and you have HTTPS on app.example.com, proxied to your app. Running a second app is one more block:
Caddy also handles two details for you, per its reverse_proxy documentation. It passes the original Host header through and sets X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host so your app knows the visitor's IP and that the request came in over HTTPS. And it proxies WebSocket connections without extra config.
One catch worth knowing: Caddy ignores incoming X-Forwarded-* values by default to stop spoofing. If something like Cloudflare sits in front of Caddy, you set the trusted_proxies global option so it believes the real client IP from that layer.
How do you set up Nginx as a reverse proxy?
Nginx needs a little more typing, and it doesn't get certificates on its own (you pair it with a tool such as Certbot). The core is the proxy_pass directive inside a location block, as the Nginx admin guide shows.
Those header lines aren't decoration. The Nginx docs say that by default it rewrites the Host header to the backend's address and sets Connection to close. Many apps then build wrong redirect URLs or log every visitor as 127.0.0.1.
The last three lines are for WebSockets, which real-time apps like n8n's editor rely on. Upgrade and Connection are hop-by-hop headers, so Nginx doesn't pass them along unless you set them explicitly. The nginx.org WebSocket page notes the proxy_http_version line is only needed before version 1.29.7. Leaving it in is harmless on newer releases.
Here's what usually goes wrong: a trailing slash. If proxy_pass includes a path, such as http://127.0.0.1:9000/app/, Nginx replaces the matched part of the request URI with it. Add or drop that slash by accident and every request lands on the wrong path.
Where does a reverse proxy fit on a VPS?
On a typical self-hosting box, the reverse proxy is the only thing listening on the public ports. Everything else hides behind it.

The traffic flows like this: the visitor's browser looks up app.example.com, DNS returns your VPS's IP, the request hits Caddy or Nginx on port 443, and the proxy forwards it to the right container on a local port. The app never touches the internet directly.
That design pairs well with a firewall that only allows SSH, 80 and 443. My steps to secure a VPS cover the firewall rules, plus the Docker port trap that can quietly expose a container even when the firewall says no.
If you'd rather not write proxy configs at all, platforms like Coolify ship a reverse proxy built in. My guide to self-hosting apps with Coolify or Docker on a VPS walks through both routes.
For the server itself, I recommend a Hostinger KVM VPS. A KVM plan gives you full root access, which is what you need to install Caddy or Nginx and bind ports 80 and 443.
Can a reverse proxy replace a forward proxy, or a VPN?
No. They solve problems on opposite ends of the connection.
A reverse proxy on your server does nothing for your own browsing. It can't change the IP a website sees when you visit it, because it isn't in that path. If you need a different exit IP for scraping, testing ads or managing accounts, you need a forward proxy.
A forward proxy can't protect your site either. Visitors never pass through it, so it can't terminate TLS, cache your pages or hide your origin.
VPNs are a third thing again. A VPN tunnels all of a device's traffic at the system level, while a forward proxy usually handles one app or protocol at a time. I compare them in detail in proxy vs VPN: what's the difference, and if you're choosing a forward proxy protocol, read SOCKS5 vs HTTP proxies.
Which one do you need?
Match the job to the side of the connection:
- You want websites to see a different IP than yours: forward proxy
- You need to filter or log what a team browses: forward proxy
- You're scraping and keep getting blocked: forward proxy (the IP type matters more than the protocol)
- You run apps on a server and want HTTPS on proper domains: reverse proxy
- You want to hide your server's IP or absorb traffic spikes: reverse proxy, often a CDN such as Cloudflare
- You run several copies of an app: reverse proxy as a load balancer
Plenty of setups use both. A scraper might send requests out through a forward proxy, collect the data, and serve a dashboard from a VPS behind Caddy. Different jobs, different sides.
Frequently asked questions
If you're putting apps online, start with a reverse proxy on a small VPS and add a forward proxy only when a task needs a different exit IP. Caddy plus one Caddyfile gets you most of the way in an afternoon.


