Nextcloud no more reachable after reverse proxy configuration

I’ve a working installation of nextcloud where nc is reachable at https://mydomain.net/nextcloud.

Under https://mydomain.net/ you get the default apache website. Now I want to change this working configuration to make a nodejs app available under https://mydomain.net/.

The only site enabled is 020-*****.net.conf. It has the following content:

<IfModule mod_ssl.c>
  <VirtualHost *:80>
    ServerName ******.net
    ServerAlias dev.******.net

    Redirect permanent / https://dev.******.net/
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </VirtualHost>

  <VirtualHost _default_:443>
    ServerName ******.net
    ServerAlias dev.******.net
    ServerAdmin ******@gmail.com

    SSLCertificateFile /etc/letsencrypt/live/dev.******.net/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/dev.******.net/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    ProxyRequests off

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

    <Location /nextcloud>
      Require all granted
      Options FollowSymlinks MultiViews
      AllowOverride All

      <IfModule mod_dav.c>
        Dav off
      </IfModule>

      SetEnv HOME /var/www/html/nextcloud
      SetEnv HTTP_HOME /var/www/html/nextcloud
    </Location>

    Alias /nextcloud "/var/www/html/nextcloud/"

    # <Location />
    #   ProxyPass http://localhost:3000/
    #   ProxyPassReverse http://localhost:3000/
    # </Location>
  </VirtualHost>
</IfModule>

This is the working configuration! If I do uncomment the following four lines, my nodejs app is reachable, but NC not.

    <Location />
      ProxyPass http://localhost:3000/
      ProxyPassReverse http://localhost:3000/
    </Location>

Any hints are welcome. Maybe it would be possible to use another approache?

Thanks in advance!

Achim

Sorry, read your post first time wrongly. How about to expose your nodeJS app under e.g. https://mydomain.net/nodeJSApp and then just do redirect of root folder to it?

<IfModule mod_ssl.c>
  <VirtualHost *:80>
    ServerName ******.net
    ServerAlias dev.******.net

#    Redirect permanent / https://dev.******.net/
    Redirect permanent / https://dev.******.net/nodeJSApp
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </VirtualHost>

  <VirtualHost _default_:443>
    ServerName ******.net
    ServerAlias dev.******.net
    ServerAdmin ******@gmail.com

    SSLCertificateFile /etc/letsencrypt/live/dev.******.net/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/dev.******.net/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    ProxyRequests off

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

    <Location /nextcloud>
      Require all granted
      Options FollowSymlinks MultiViews
      AllowOverride All

      <IfModule mod_dav.c>
        Dav off
      </IfModule>

      SetEnv HOME /var/www/html/nextcloud
      SetEnv HTTP_HOME /var/www/html/nextcloud
    </Location>

    Alias /nextcloud "/var/www/html/nextcloud/"

     <Location /nodeJSApp>
       ProxyPass http://localhost:3000/
       ProxyPassReverse http://localhost:3000/
     </Location>
  </VirtualHost>
</IfModule>