Skip to content

“Connection lost” error in self-hosted n8n behind ALB + NGINX reverse proxy on version v1.99.1 #16820

Open
@ProductVartopia

Description

@ProductVartopia

Bug Description

I’ve deployed n8n (v1.99.1) in a Docker container behind:

An AWS Application Load Balancer (ALB) handling SSL termination

A local NGINX reverse proxy forwarding traffic to the Docker container

WebSocket support is configured (including connection_upgrade and related headers)

All environment variables are set properly

N8N_PUSH_BACKEND=websocket is explicitly configured

Despite all efforts, the UI always shows a "Connection lost" banner and WebSocket connections fail silently (status = finished, no data transferred).

Deployment Details
ALB

  • HTTPS listener on port 443
  • Forwarding to a Target Group (port 80)
  • Health checks working
  • No sticky sessions
  • Path-based forwarding enabled
  • SSL certificate installed and valid

NGINX Config (/etc/nginx/sites-available/n8n)

server {
    listen 80;
    server_name domain;
    location /rest/push/ {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_set_header Origin $http_origin;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
    }
    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
        proxy_set_header Origin $http_origin;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
    }

}

Main NGINX Conf (/etc/nginx/nginx.conf)

http {
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }
}
Docker .env
env
Copy
Edit
N8N_HOST=domain
N8N_PORT=5678
N8N_PROTOCOL=http
N8N_EDITOR_BASE_URL=https://domain.com
WEBHOOK_URL=https://domain.com
N8N_PUSH_BACKEND=websocket
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=password
GENERIC_TIMEZONE=Asia/Kolkata

Additional Notes
Running curl -I -u admin:... https://domain.com/rest/push returns a redirect to http://..., indicating a mismatch due to ALB SSL termination.

WebSocket attempts show as Finished but do not establish a stream.

All headers (Origin, Host, Upgrade, Connection, etc.) are correctly forwarded via NGINX.

The same deployment works fine on v1.74.0.

This is blocking usage of n8n on the current stack.

Please let us know if something changed in WebSocket handling in recent versions that would explain the persistent connection lost message in the UI despite correct reverse proxy and ALB setup.

To Reproduce

To Reproduce
Launch n8n via Docker on Ubuntu 22.04 behind NGINX

Terminate SSL at ALB, forward HTTP to EC2 instance

Ensure correct headers are added in NGINX for WebSocket

Open the editor in browser: https://domain.com

Observe persistent "Connection lost" in UI

Expected behavior

n8n UI should remain connected and live features (workflow updates, execution state) should work properly with WebSocket enabled.

Operating System

Ubuntu

n8n Version

v1.99.1 (Docker)

Node.js Version

Bundled with Docker image

Database

PostgreSQL

Execution mode

main (default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs FeedbackWaiting for further input or clarification.in linearIssue or PR has been created in Linear for internal review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions