Hello, I'm running n8n within a docker container. It is accessible via subdomain and reverse proxy. I placed the Apache Directive below which does the trick to access n8n via https://n8n.example.com # Exclude ACME challenge from proxy <Location "/.well-known/acme-challenge/"> ProxyPass ! </Location> # Proxy everything else ProxyPreserveHost On ProxyPass / http://localhost:5678/ ProxyPassReverse / http://localhost:5678/ I can connect n8n to external services like Paypal or Mautic. The problem I'm experiencing is that when I'm trying to execute a workflow I'm receiving the following error from the n8n backend: "Problem running workflow Lost connection to the server" After searching the web I found out that it may be because of websocket issues. Has anyone here experienced similar problems and has a solution? Many thanks Christian
WebSocket connections require special handling in Apache, so without that, the connection drops as soon as n8n tries to stream execution updates. First, make sure required Apache modules are enabled Code: a2enmod proxy a2enmod proxy_http a2enmod proxy_wstunnel a2enmod rewrite a2enmod headers systemctl restart apache2 Secondly, update your VirtualHost config. Try to replace your proxy section with this: Code: # Allow WebSocket upgrades RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://localhost:5678/$1 [P,L] # Normal HTTP proxy ProxyPreserveHost On ProxyPass / http://localhost:5678/ ProxyPassReverse / http://localhost:5678/ # ACME challenge exclusion <Location "/.well-known/acme-challenge/"> ProxyPass ! </Location> Thirdly, add timeout + buffering tweaks, because n8n workflows can run long, so Apache timeouts can also cause disconnects. Code: ProxyTimeout 600 ProxyPass / http://localhost:5678/ retry=0 timeout=600 keepalive=On Fourthly, make sure n8n knows it's behind HTTPS, so change inside your Docker environment variables: Code: N8N_HOST=n8n.example.com N8N_PROTOCOL=https WEBHOOK_URL=https://n8n.example.com/ Then restart the container. Finally, after applying all the above changes, restart Apache, then open n8n and run a workflow manually. See whether you have a live execution without disconnects. The above logic is partly Ai generated, and not tested, so though reversible, apply it at your own risk.