Hey all! I keep getting “Connection Lost” when running n8n via a apache revese proxy.
My config is as follows:
<VirtualHost *:443>
ServerName n8n.domain.com
ServerAlias n8n.domain.com
DocumentRoot /var/www/n8n.domain.com
RewriteEngine On
RewriteCond %(HTTP:Upgrade) websocket [NC]
RewriteRule /(.*) ws://localhost:5678/$1 [P,L]
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/
SSLCertificateFile /etc/letsencrypt/live/s1.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/s1.domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ErrorLog n8n.domain.com.in-error_log
CustomLog n8n.domain.com.in-access_log common
Chrome console shows the following: index-683d9781.js:220 WebSocket connection to ‘wss://n8n.domain.com/rest/push?sessionId=v86rbfg9rqn’ failed:
Do you have any idea why this will not work?
What is the error message (if any)?
Chrome console shows the following: index-683d9781.js:220 WebSocket connection to ‘wss://n8n.domain.com/rest/push?sessionId=v86rbfg9rqn’ failed:
Please share your workflow
(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
<!-- If you need help with data transformations, please also share your expected output. -->
## Information on your n8n setup
- **n8n version:** Latest
- **Database (default: SQLite):** Default
- **n8n EXECUTIONS_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** Docker
- **Operating system:** Ubuntu
It sounds like your reverse proxy isn’t correctly configured - if you’re on latest you should already have N8N_PUSH_BACKEND to websocket, but could you post the rest of your Docker compose file for us to take a look? Obviously don’t post any sensitive credentials
The problem may be the Apache config, but someone like @Jon would unfortunately be more familiar with this. That being said, you may also want to check out this post: