I’m running n8n since a long time succesfully on the systems of our hosting partner maxcluster.
n8n runs behind an nginx reverse proxy as an npm package. After upgrading to version 1.0.5 and switching to websockets I’ve encountered some issues regarding the session handling.
As far as I debugged it for now, all server request and also the login with my existing user is succesfull. But for a currently unknown reason all calls to “GET /rest/push?sessionId=” getting a 401 and therefore the web ui tells me the server is offline.
I’ve also removed the .n8n folder an started with a fresh instance, but got the same issue.
Do you have any idears or tipps to handle this issue?
Developer Console Js Error
pushConnection.ts:96 WebSocket connection to 'wss://n8n.xxx.xx/rest/push?sessionId=xxxxx' failed:
To handle htaccess and IP filtering within the admin UI of the hosting system, we placed Varnish (without any rules) before Nginx. However, since Varnish is not able to handle websockets, it fails (even with the workarounds mentioned in the Varnish documentation).
I turned off Varnish and moved the IP filter and htaccess configurations into Nginx.
Hi @tniebergall, I am sorry you are having trouble.
I am not overly familiar with nginx (I am using mostly caddy these days), but your configuration looks good to me on first sight. Are there any other components in your network infrastructure possibly interfering with the connection?
The easiest way to verify this would be to simply spin up a n8n instance on your current machine, then open http://localhost:5678, so no network traffic is involved. You should be able to see the execution progress and websocket messages as expected when executing a simple workflow:
If the websocket connections still fail for you even when connecting to local instance, the problem might be with a browser plugin.
If the previous method (server-sent events) was working fine for you, you could alternatively just set the N8N_PUSH_BACKEND=sseenvironment variable and restart n8n to pick up the change.
As I mentioned in my second Part of the topic, Varnish was the issue in the chain. Because Varnish has no (or no real) support for websockets the connection failes.
After removing varnish in the chain n8n and the websockets are working perfectly.