Blossom Logo Blossom

Caddy Routing and Load Balancing

Blossom uses Caddy as a load balancer and reverse proxy. Understanding how requests flow through Caddy helps debug routing and connectivity issues.

Request Flow Architecture

Internet → Caddy → Internal Network → Your App Container
  1. External requests hit Caddy on ports 80/443
  2. Caddy routes based on domain/host headers
  3. Internal routing uses Docker network hostnames
  4. App containers receive requests on assigned ports

Debugging Levels

1. Test Direct Container Access

First, verify your app container is responding:

# SSH into your server
ssh root@your-server-ip

# Go to /blossom/caddy with compose.yml
cd /blossom/caddy

# Test direct container access
docker compose exec -ti caddy curl app-111-web-process-1:3000
  • Reverse Proxy: Look for the reverse_proxy for the config in Caddyfile, eg: app-111-web-process-1
  • Expected: Your app’s HTML response
  • If fails: Check Web Server Port Configuration.

2. Test Internal Network Routing

Test Caddy’s internal routing through the .network hostname:

# Test internal network routing
curl -H "X-Original-Host: random-xxx.onblsm.com" http://app-111-server-222.network
  • Expected: Your app’s HTML response
  • If fails: Check Caddy configuration and internal networking /etc/hosts

3. Test External Domain Access

Test the full external routing:

# Test external domain (Blossom managed)
curl https://random-xxx.onblsm.com
  • Expected: Your app’s HTML response
  • If fails: Check SSL certificates and DNS. Note the https usage here.

To debug DNS: host random-xxx.onblsm.com

Pro Tips

Usually the issue will be your app not starting up. The key thing to key is your app itself.

# Find the app of interest
docker compose ls
cd /blossom/apps/app-111/app-111-web # or app-111-web-swap

# Check logs
docker compose logs -n 1 -f

Checking the logs will usually reveal the issue.