Files
capitalism-eats-the-world/CADDY.md

1.5 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:

  1. Automatic SSL certificate management with Let's Encrypt
  2. Reverse proxy to the Flask application
  3. Proper WebSocket support for real-time updates
  4. Proxy header forwarding for client IP and protocol information

Setup Instructions

  1. 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
    }
    
  2. Ensure your DNS is properly configured to point markov.elpatron.me to your server's IP address.

  3. 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
  • Proxy headers are forwarded 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.