Files
coop/docs/CADDY-CONFIG.md
T

1.3 KiB

Caddy Configuration

Caddy handles SSL termination and routes to the application services running on 172.20.1.238.

Caddyfile Example

coop.hobokenchicken.com {
    # Frontend (Next.js)
    handle /* {
        reverse_proxy 172.20.1.238:3000
    }

    # API routes — use handle (NOT handle_path) to preserve /api/ prefix
    handle /api/* {
        reverse_proxy 172.20.1.238:3002
    }

    # Webhooks
    handle /webhooks/* {
        reverse_proxy 172.20.1.238:3002
    }

    # WebSocket support
    handle /socket.io/* {
        reverse_proxy 172.20.1.238:3002
    }
}

Critical: Use handle (not handle_path) for /api/* and /webhooks/*. handle_path strips the path prefix, which breaks Express routing.

Docker Compose (no nginx)

Services bind as follows:

  • Frontend: 0.0.0.0:3000 (bridge network, accessible from Caddy)
  • Backend: localhost:3002 (host network, accessible from Caddy via host IP)
  • Postgres: 127.0.0.1:5432 (localhost only)
  • Redis: 127.0.0.1:6379 (localhost only)

Backend Port

Backend runs on port 3002 (not 3001). Caddy must proxy to 172.20.1.238:3002.

Start Stack

# Start services
docker-compose up -d

# Verify backend
curl http://172.20.1.238:3002/health

# Verify frontend
curl http://172.20.1.238:3000

Caddy automatically provisions SSL and routes traffic.