Not able to access websockets on self hosting n8n

Describe the problem/error/question

After self hosting n8n on my server, i am getting below issue
You have a connection issue or the server is down. n8n should reconnect automatically once the issue is resolved.

What is the error message (if any)?

You have a connection issue or the server is down. n8n should reconnect automatically once the issue is resolved.

Please share your workflow

I am not able to create workflow as its not able to connect to sockets

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

My docker-compose file

version: '3.1'

services:
  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    restart: always
    volumes:
      - ./n8n_data:/home/node/.n8n
    environment:

@Akshay_Rajesh_Shinde Hey,

normally issue with proxy and needing to enable websockets support, question time, does this happen all the time? and are you using nginx? or trafik? if so please share the config ure using :slight_smile:
Samuel

Below is my nginx configuration. We have deployed it and since then its not able to make the websocket connection.

server {
    listen 443 ssl;
    ssl_certificate /home/lgap/n8n/fullchain.crt;
    ssl_certificate_key /home/lgap/n8n/privatekey.key;
    server_name automation.ly.design;
    location / {
    	proxy_pass http://localhost:5678/;
    	proxy_http_version 1.1;
    	proxy_set_header Upgrade $http_upgrade;
    	proxy_set_header Connection "upgrade";
    	proxy_set_header Host $host;
    	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_set_header Cookie $http_cookie;
    	proxy_set_header Authorization $http_authorization;
	proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
    	proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
    }
    location /webhook/ {
        proxy_pass http://localhost:5678;
        proxy_set_header Host $host;
        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;
    }
    location /webhook-test/ {
        proxy_pass http://localhost:5678;
        proxy_set_header Host $host;
        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;
    }
    # Error Pages
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}

@Akshay_Rajesh_Shinde

I think on ure webhook and webhook-test u need the socket upgrades on too, also what n8n env vars are you using?

You can try add this too

proxy_read_timeout 3600;
proxy_send_timeout 3600;

Then reload config, it might be worth digging into devtools in chrome to see is there any message why connection issues too.

Samuel

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.