I have a self-hosted n8n and when I open the n8n, I get a “connection lost” error. I tried to solve it with multiple solutions but it is not getting resolved. I also added N8N_PUSH_BACKEND=ssel, asked chat gpt and tried many other options but it is not getting resolved.
Troubleshooting Steps Taken for Connection Lost Error in n8n (Self-Hosted)
Environment:
VPS: Hostinger (Ubuntu 24.04 KVM)
n8n: Docker container (latest tag - v1.99.1)
Reverse Proxy: Nginx
Domain: https://n8n.revisionwave.com
SSL: Handled via Nginx (Let’s Encrypt / manually configured)
Installed and configured Docker & Nginx on a clean VPS.
Pulled latest n8nio/n8n image using:
Created and ran Docker container with necessary environment variables:
Configured Nginx reverse proxy (ports 80/443) with WebSocket support:
Updated and restarted Docker container multiple times after modifying environment variables.
Tested both sse and websocket push backends:
Error remained in both cases.
Checked logs using docker logs -f n8n, which showed repeated error but that also solved
Browser troubleshooting done:
Attempted to fix ‘origin’ issue by setting all URL-related env vars, including:
N8N_EDITOR_BASE_URL
VUE_APP_URL_BASE_API
WEBHOOK_TUNNEL_URL
Observed deprecation warning in logs:
please help me to solve this issue.
@Jitendra_Kavire
Are you getting any ssl certificate error in the logs?
No, I have successfully added the SSLC certificate, i tried every where to solve this “connection lost” error, i am requesting you guys please connect me and help me to solve this problem. requesting you guys please please help.
I use the following setup. I have a docker-compose to run auto nginx and ssl for my containers.
base/docker-compose.yml
services:
nginx-proxy:
image: jwilder/nginx-proxy:latest
container_name: nginx
restart: always
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /var/containers/volumes/nginx/certs:/etc/nginx/certs
- /var/containers/volumes/nginx/vhost.d:/etc/nginx/vhost.d
- /var/containers/volumes/nginx/html:/usr/share/nginx/html
environment:
- DHPARAM_GENERATION=false
networks:
- nginx
nginx-proxy-ssh:
image: jrcs/letsencrypt-nginx-proxy-companion:latest
container_name: nginx-ssl
restart: always
volumes_from:
- nginx-proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- DEFAULT_EMAIL=<YOUR EMAIL ADDRESS HERE>
networks:
- nginx
networks:
nginx:
Example of my n8n setup joined to the base-nginx network so that nginx and auto ssl can do its job
services:
n8n-db:
image: postgres:16.1
container_name: n8n-db
restart: always
environment:
- POSTGRES_DB=n8n
- POSTGRES_PASSWORD=n8n
- POSTGRES_USER=n8n
# - PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- /var/containers/volumes/n8n/postgres-data:/var/lib/postgresql/data
n8n:
image: docker.n8n.io/n8nio/n8n:latest
container_name: n8n
restart: always
depends_on:
- n8n-db
volumes:
- /var/containers/volumes/n8n/app-data:/home/node/.n8n
environment:
- LETSENCRYPT_HOST=n8n.revisionwave.com
- VIRTUAL_HOST=n8n.revisionwave.com
- VIRTUAL_PORT=5678
- WEBHOOK_URL=https://n8n.revisionwave.com
- DB_TYPE=postgresdb
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_HOST=n8n-db
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_SCHEMA=n8n
- DB_POSTGRESDB_PASSWORD=n8n
- N8N_RUNNERS_ENABLED=true
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
networks:
default:
name: base_nginx
external: true
Take note of joining the network for the base nginx containers as well as setting the dns in these env vars
- LETSENCRYPT_HOST=n8n.revisionwave.com
- VIRTUAL_HOST=n8n.revisionwave.com
- VIRTUAL_PORT=5678