Reverse Proxy Setup
Caddy’s reverse proxy is a production-grade, highly configurable module that supports load balancing, active and passive health checks, dynamic upstreams, and more.Basic Reverse Proxy
Proxy requests to a backend server:Multiple Upstreams
Load balance across multiple backends:Load Balancing Policies
Health Checks
Active Health Checks
Periodically check upstream health in the background:Active health checks run on a timer and require at least
uri or port to be set. They do not run for dynamic upstreams.Passive Health Checks
Monitor proxied requests for errors:Header Manipulation
Request Headers
Modify headers sent to the upstream:Response Headers
Modify headers returned to clients:Transport Configuration
HTTP Transport
TLS Configuration
Connect to upstreams over HTTPS:Request Buffering
Buffer requests/responses for slow clients or backends:WebSocket Support
Caddy automatically detects and handles WebSocket connections:Handle Response
Intercept and handle upstream responses:Trusted Proxies
Define which proxies to trust forX-Forwarded-* headers:
Complete Example
Placeholders
Available placeholders during reverse proxy:{http.reverse_proxy.upstream.address}- Full upstream address{http.reverse_proxy.upstream.host}- Upstream host{http.reverse_proxy.upstream.port}- Upstream port{http.reverse_proxy.upstream.requests}- Current request count{http.reverse_proxy.upstream.latency}- Response latency{http.reverse_proxy.duration}- Total proxy duration{http.reverse_proxy.retries}- Number of retries performed