Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Fix n8n 'Connection Lost' and Webhook URLs Behind a Proxy

Description and use

When n8n is behind a reverse proxy, the "Connection lost" badge and incorrect webhook URLs are fixed by setting N8N_WEBHOOK_URL and configuring the proxy to forward WebSocket upgrades and preserve the Host header.

Problem

When n8n is placed behind a reverse proxy, the editor shows a persistent "Connection lost" badge and webhook URLs contain localhost or an internal port, preventing external access.

Outcome

After setting N8N_WEBHOOK_URL and configuring the proxy to forward WebSocket upgrades and preserve the Host header, n8n functions correctly behind the proxy: webhook URLs are externally reachable and the editor maintains a live connection.

Workflow

  • 1. Add environment variables to the n8n service: N8N_HOST, N8N_PROTOCOL, N8N_WEBHOOK_URL, N8N_PROXY_HOPS=1.
  • 2. Recreate the container with docker compose up -d to apply env changes.
  • 3. Configure the reverse proxy to pass WebSocket upgrades and preserve the Host header (enable Websockets Support in Nginx Proxy Manager or add proxy_set_header directives in nginx).
  • 4. Verify that webhook URLs in the editor start with the public domain and that the "Connection lost" badge disappears.

Evidence

Webhook URLs now read https://n8n.example.com/webhook/... , with no port.

Source

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.

Source

Set N8N_PROXY_HOPS=1 for one proxy, so n8n trusts the X-Forwarded-* headers.

Source

  • Record date: 2026-10-25T09:26:43.989Z