What is a reverse proxy? Nginx and Caddy explained for beginners
A reverse proxy is a server that sits in front of your application and handles incoming requests on its behalf. Visitors talk to the proxy; the proxy talks to your app.
Why use one
- HTTPS: the proxy handles certificates and encryption, so your app doesn't have to.
- One public entry point: your app can listen on an internal port like 3000 while the proxy serves ports 80 and 443.
- Multiple apps on one server: route
blog.example.comto one app andapi.example.comto another. - Static files and compression: proxies serve files and compress responses efficiently.
- Basic protection: rate limiting, request size limits, hiding internal details.
Nginx vs Caddy at a glance
- Nginx: extremely widely used, flexible, lots of documentation. HTTPS usually needs a separate tool such as Certbot.
- Caddy: simpler config files and automatic HTTPS out of the box. A popular choice for beginners and small projects.
Both are solid; many people start with Caddy for ease and learn Nginx because they encounter it everywhere.
Forward proxy vs reverse proxy
A forward proxy acts for clients (like a corporate web proxy). A reverse proxy acts for servers.
Common gotcha
Your app may see every request coming from the proxy's address. Configure it to read forwarded headers so logs show real client IPs.
Which proxy did you start with? Is there a config mistake you made that others should avoid?
Comments · 4
Caddy's automatic HTTPS makes the first setup nearly painless. Nginx has more guides and flexibility, but the config takes more learning.
Reverse proxy = a front door for your app. It handles HTTPS, routing and sometimes caching, so the app doesn't have to.
How is a reverse proxy different from a load balancer? They sound similar, and I've seen both terms used for the same tool.
Good question. A load balancer spreads traffic across several servers, and many reverse proxies can do this too. So the roles overlap, though a reverse proxy does more than balance.