For selfhosted n8n using nginx getting 1008 websocket issues

Getting this issue after integrating ssl certs and nginx

what is the possible fix

Try adding this environment variable to your n8n environment/startup

N8N_PUSH_BACKEND=websocket

I also added these to my docker instance behind nginx. I honestly don’t remember why I left that VUE one ‘internal’ vs external, but it wasn’t an accident

-e VUE_APP_URL_BASE_API=http://192.168.0.14:5678
-e N8N_TEMPLATES_ENABLED=true -e N8N_PROXY_HOPS=1
-e N8N_HOST=https://myinstance.mydomain.com
-e N8N_EDITOR_BASE_URL=https://myinstance.mydomain.com
-e WEBHOOK_URL=https://myinstance.mydomain.com

Make sure your NGINX config includes the following for the WebSocket upgrade:

nginx

CopyEdit

location / {
    proxy_pass http://localhost:5678;  # Adjust if your n8n port differs
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

Also, ensure your server block has:

nginx

CopyEdit

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

:locked_with_key: If using SSL (https):

Make sure this block is under your server { listen 443 ssl; } block, not just for port 80.