1.9 KiB
1.9 KiB
Caddy Server Configuration
This project uses Caddy as a reverse proxy to handle SSL termination with Let's Encrypt and WebSocket support for the domain markov.elpatron.me
.
Configuration
The Caddy configuration is defined in the Caddyfile and includes:
- Automatic SSL certificate management with Let's Encrypt
- Reverse proxy to the Flask application
- Proper WebSocket support for real-time updates
- Simplified configuration with automatic header forwarding
Setup Instructions
-
Update the email address in the Caddyfile to your actual email for Let's Encrypt notifications:
markov.elpatron.me { tls your-email@example.com # ... rest of configuration }
-
Ensure your DNS is properly configured to point
markov.elpatron.me
to your server's IP address. -
Start the services with Docker Compose:
docker-compose up -d
How It Works
- Caddy automatically obtains and renews SSL certificates from Let's Encrypt
- All HTTP traffic is automatically redirected to HTTPS
- WebSocket connections are properly handled and forwarded to the Flask-SocketIO application
- Caddy automatically forwards standard proxy headers to preserve client IP and protocol information
WebSocket Support
The configuration includes specific handling for WebSocket upgrade requests to ensure real-time features work correctly:
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
This ensures that SocketIO connections can be established and maintained properly through the proxy.
Configuration Optimization
The Caddyfile has been optimized to:
- Remove unnecessary header forwarding directives (Caddy automatically forwards standard headers)
- Maintain clear separation between general reverse proxy rules and WebSocket-specific rules
- Keep the configuration simple and maintainable