Basic Configuration
Caddy makes it simple to set up a reverse proxy with automatic TLS. Here’s a minimal Caddyfile:- Obtains and renews TLS certificates via Let’s Encrypt
- Redirects HTTP to HTTPS
- Sets HTTP/2 and HTTP/3
Complete Example
Here’s a production-ready setup with all recommended headers: Caddyfile:Automatic HTTPS
For automatic HTTPS with Let’s Encrypt:- Obtains a TLS certificate from Let’s Encrypt
- Renews certificates before expiration
- Redirects HTTP to HTTPS
Custom TLS Certificates
To use your own certificates:Multiple Backends
Protect multiple applications with one Anubis instance:Path-Based Routing
Protect only specific paths:--base-prefix /admin.
Header Configuration
Caddy automatically sets several headers, but you can customize them:Placeholders
Caddy provides many useful placeholders:{remote_host}- Client IP address{scheme}- http or https{host}- Host header value{method}- HTTP method{uri}- Request URI{http.request.proto}- HTTP version{http.request.tls.version}- TLS version{http.request.tls.cipher_suite}- TLS cipher suite
Health Checks
Caddy can perform active health checks on Anubis:Load Balancing
Run multiple Anubis instances behind Caddy:Logging
Customize access logs:Advanced Configuration
Custom Error Pages
Rate Limiting
Caddy can rate limit before reaching Anubis:Request Buffering
Testing
Test your Caddy configuration:Troubleshooting
Certificate Issues
If Let’s Encrypt certificates fail:IP Address Not Detected
Verify Anubis receives the correct IP:- Don’t use
--use-remote-addresswhen behind Caddy - Ensure
header_up X-Real-IP {remote_host}is set - Check Anubis logs for received IP
Connection Refused
Check that:- Anubis is running:
docker ps - Anubis is listening on correct port
- Network connectivity:
docker exec caddy wget -O- http://anubis:3000/