| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- # Caddyfile for client2server
- # Single port (:3843) serves WebSocket and HTTP API; Caddy load-balances
- # across server1 and server2 in the Docker network.
- {
- # Global options
- # email your@email.com
- admin off
- auto_https off
- }
- # ========================================
- # Unified WebSocket + HTTP load balancer (:3843)
- # ========================================
- :3843 {
- # Backend servers (Docker network DNS)
- reverse_proxy server1:3843 server2:3843 {
- # Health check each backend
- health_uri /health
- health_interval 10s
- health_timeout 5s
- health_status 2xx
- # Load balancing policy
- lb_policy round_robin
- # WebSocket support (long-lived connections)
- # Caddy auto-detects Upgrade headers, no explicit directive needed
- }
- # Preserve client info
- header_up X-Real-IP {remote}
- header_up X-Forwarded-For {remote}
- header_up X-Forwarded-Proto {scheme}
- # Timeouts for long-lived WebSocket connections
- timeouts {
- read 300s
- write 300s
- idle 300s
- }
- }
- # ========================================
- # Dashboard (port 80) - React SPA via separate Caddy in dashboard container
- # ========================================
- :80, :443 {
- reverse_proxy dashboard:80
- }
- # ========================================
- # TLS for HTTPS (optional - requires auto_https on)
- # ========================================
- # tls {
- # # Let's Encrypt (automatic)
- # }
|