High · HTTPS & Caddy
How to Fix HTTP 502 Bad Gateway (Caddy / Nginx → n8n)
TL;DR Fix
Reverse proxy is pointing to 127.0.0.1:5678 inside another container, or n8n crashed in a restart loop. Keep Caddy and n8n on the same Docker Compose bridge network.
Exact Error Signature
502 Bad Gateway | dial tcp: lookup n8n: no such host | connection refused
Copy-Paste Fix Commands
docker compose ps && docker compose logs --tail=50 n8n
# In Caddyfile, proxy to Docker service name (NOT localhost):
# reverse_proxy n8n:5678
Preventing Recurrence
Keep Caddy and n8n on the same Docker Compose bridge network.