Issue with connection lost on when using apache proxy

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>
        ServerName n8n.yourdomain.com
        RewriteEngine on

        ProxyPreserveHost On

        ProxyPass / http://127.0.0.1:5678/
        ProxyPassReverse / http://127.0.0.1:5678/

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

</VirtualHost>

Restart apache2
sudo systemctl restart apache2