Issue with connection lost on when using apache proxy

Describe the problem/error/question

Hey all! I keep getting “Connection Lost” when running n8n via a apache revese proxy.

My config is as follows:

<VirtualHost *:443>
DocumentRoot /var/www/ 

RewriteEngine On
RewriteCond %(HTTP:Upgrade) websocket [NC]
RewriteRule /(.*)    ws://localhost:5678/$1 [P,L]

ProxyPreserveHost On

ProxyPass /
ProxyPassReverse /

SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
Include /etc/letsencrypt/options-ssl-apache.conf

CustomLog common

Chrome console shows the following: index-683d9781.js:220 WebSocket connection to ‘wss://’ 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://’ 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

Hi @dg92 :wave: Sorry to hear you’re running into this!

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 :sweat_smile:

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:


It looks like this is the likely cause, @dg92 let me know how you get on with the change to your Apache config.


Hey All,

thanks for the info! I will give it a try. Thank you.

1 Like

Enable Apache module proxy and proxy_wstunnel

sudo a2enmod proxy

sudo a2enmod proxy_wstunnel

edit apache2 conf with the content bellow
sudo vi /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        RewriteEngine on

        ProxyPreserveHost On

        ProxyPass /
        ProxyPassReverse /

        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/?(.*) "ws://$1" [P,L]


Restart apache2
sudo systemctl restart apache2


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.