✅ solved: "Connection Lost" in workflow editor

I had this “Connection Lost” in workflow editor for more than a week. tried everything found on the forums. Nothing worked. Then I reinstalled the n8n ( on GCP using Docker ), still error wasn’t fixed. So finally I decided give all my configurations and errors to chatGPT and ask to help. Finally it helped me to fix it. The issue was in the WebSockets.

nginx config : before fix

server {
    server_name automation.webloomlabs.net;
    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/automation.webloomlabs.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/automation.webloomlabs.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = automation.webloomlabs.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name automation.webloomlabs.net;
    return 404; # managed by Certbot


}

nginx config : after fix

server {
    server_name automation.webloomlabs.net;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;

        # WebSocket support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Required headers
        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;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/automation.webloomlabs.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/automation.webloomlabs.net/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
    if ($host = automation.webloomlabs.net) {
        return 301 https://$host$request_uri;
    }

    listen 80;
    server_name automation.webloomlabs.net;
    return 404;
}

1 Like

Excelente bro, muchas gracias. No hay prácticamente nada de ayuda en español y encontrarte llevó un tiempo… Lo que hice fue actualizar a la versión más actual de n8n (latest version), Para eso me tocó configurar la autenticación de dos pasos de GCP. Luego hagan la configuración de Nginx (algunos la pueden tener en Apache. Igual, lo explica con ese modo). Para ello, usé Gemini y fue paso a paso hasta lograrlo.

Please be polite and post in English on this forum.