Asked 1 month ago by EtherealMariner179
How do I resolve n8n WebSocket connection errors with my Nginx setup?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by EtherealMariner179
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I'm experiencing an issue where the n8n frontend fails to update due to a WebSocket error when using Nginx as a reverse proxy. Without Nginx, the workflow updates correctly. I've gathered some logs and configuration details below to help diagnose the problem.
BASH2025-01-26T21:06:00.026Z | debug | Querying database for waiting executions {"scopes":["waiting-executions"],"file":"wait-tracker.js","function":"getWaitingExecutions"} 2025-01-26T21:06:06.570Z | debug | Skipped browserId check on /rest/push {"file":"auth.service.js","function":"resolveJwt"} 2025-01-26T21:06:14.595Z | debug | Skipped browserId check on /rest/push {"file":"auth.service.js","function":"resolveJwt"} 2025-01-26T21:06:23.504Z | debug | Skipped browserId check on /rest/push {"file":"auth.service.js","function":"resolveJwt"} 2025-01-26T21:06:32.506Z | debug | Skipped browserId check on /rest/push {"file":"auth.service.js","function":"resolveJwt"} 2025-01-26T21:06:41.506Z | debug | Skipped browserId check on /rest/push {"file":"auth.service.js","function":"resolveJwt"}
NGINX[26/Jan/2025:21:19:34 +0000] "GET /rest/push?pushRef=tpp1fqb0zc HTTP/1.1" 401 12 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36" "-"
JAVASCRIPTWebSocket connection to 'wss://n8n.exemple.com/rest/push?pushRef=tpp1fqb0zc' failed:
NGINXserver { listen 443 ssl; server_name n8n.exemple.com; ssl_certificate /etc/letsencrypt/live/n8n.exemple.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/n8n.exemple.com/privkey.pem; ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; client_max_body_size 0; #enable for Authelia #include /config/nginx/authelia-server.conf; location / { #enable for Authelia #include /config/nginx/authelia-location.conf; proxy_pass http://n8n:5678; \tproxy_set_header Upgrade $http_upgrade; # Added for WebSocket \tproxy_set_header Connection “Upgrade”; # Modified for WebSocket \tproxy_set_header Host $host; \tproxy_set_header X-Real-IP $remote_addr; \tproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \tproxy_set_header X-Forwarded-Proto $scheme; \tchunked_transfer_encoding off; \tproxy_buffering off; \tproxy_cache off; } }
YAMLservices: n8n-db: image: postgres:16 restart: always container_name: n8n-db networks: - n8n environment: - POSTGRES_USER - POSTGRES_PASSWORD - POSTGRES_DB - POSTGRES_NON_ROOT_USER - POSTGRES_NON_ROOT_PASSWORD volumes: - ./db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh healthcheck: test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] interval: 5s timeout: 5s retries: 10 n8n: image: docker.n8n.io/n8nio/n8n restart: always container_name: n8n environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=n8n-db - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=${POSTGRES_DB} - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER} - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD} - GENERIC_TIMEZONE="Europe/Brussels" - TZ="Europe/Brussels" - N8N_HOST=n8n.exemple.com - "WEBHOOK_URL=https://n8n.exemple.com/" #- "WEBHOOK_TUNNEL_URL=https://n8n.exemple.com/" #- N8N_PROTOCOL=https - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true #- N8N_PUSH_BACKEND=websocket #- N8N_PROXY_HOPS=1 - N8N_LOG_LEVEL=debug #- N8N_SECURE_COOKIE=false #ports: # - 5678:5678 networks: - nginx_nginx - n8n - llm volumes: - ./n8n_storage:/home/node/.n8n depends_on: n8n-db: condition: service_healthy n8n-qdrant: condition: service_healthy n8n-qdrant: image: qdrant/qdrant container_name: n8n-qdrant restart: always expose: - 6333 networks: - n8n - nginx_nginx environment: - QDRANT__SERVICE__API_KEY=secret volumes: - ./qdrant_storage:/qdrant/storage healthcheck: test: - CMD-SHELL - bash -c ':> /dev/tcp/127.0.0.1/6333' || exit 1 interval: 5s timeout: 5s retries: 3 networks: nginx_nginx: external: true llm: name: llm external: true n8n: name: n8n
If anyone has insights on what might be causing the WebSocket error or suggestions for modifying the Nginx configuration, your help would be greatly appreciated. Thank you!
Comments 0
•Answers 0
•Views 95
No comments yet.