Fix n8n 'Connection Lost' and Webhook URLs Behind a Proxy
Description and use
After setting N8N_WEBHOOK_URL and configuring the proxy for WebSocket support, webhooks are publicly reachable and the editor maintains a live connection.
Problem
n8n behind a reverse proxy shows a "Connection lost" badge and generates webhook URLs with localhost or internal port, preventing external access.
Outcome
After setting N8N_WEBHOOK_URL and configuring the proxy for WebSocket support, webhook URLs are publicly reachable and the editor maintains a live connection.
Workflow
- 1. Add environment variables to docker‑compose: N8N_HOST, N8N_PROTOCOL, N8N_WEBHOOK_URL, N8N_PROXY_HOPS=1.
- 2. Recreate the container with
docker compose up -dto apply env vars. - 3. Configure the reverse proxy to allow WebSocket upgrades (Upgrade and Connection headers) and preserve the Host header (e.g., enable Websockets Support in Nginx Proxy Manager).
- 4. Verify webhook URLs in a Webhook node start with the public domain and contain no :5678 port.
- 5. Confirm the editor no longer shows "Connection lost" and live executions update.
Evidence
Webhook URLs now read https://n8n.example.com/webhook/… , with no port.
"Connection lost" in the editor: the proxy has to pass WebSocket upgrades (Upgrade and Connection headers over HTTP/1.1) and keep the original Host.
- Record date: 2026-10-16T07:55:56.897Z