The Node-Red with Apache2 - Reverse Proxy - Web Sockets Labyrinth

Summary of Issues: NR Proxy Routing in the Apache2 - conf files for Virtual Host, WSS connection errors, Cannot Click Inject Nodes, Dashboard "Not Loading"

Scenario:

I am consolidating multiple websites I host onto one server and successfully setup majority of my static sites to the one one cloud server. I have a NR instance running alongside with them attached to it's own Apache2 routed ServerAlias

Problem: The NR instance is giving issues after I manage the Apache2 conf settings for the Virtual Host associated with NR.

My case scenario with NR is that I have ( pardon if overly detailed)

~/www/server1.com
~/www/server2.com
~/www/nr-server3.com

and those are symlinked to the Apache html folders:

/var/www/server1.com
/var/www/server2.com
/var/www/nr-server3.com  <---- (This is not populated with anything,  
NR will be serving via http node endpoints)

Node-Red Settings worth noting:

httpAdminRoot: '/admin',
httpStatic: '/home/ubuntu/www/nr-server3.com/public_html',


Apache Configuration:
(Running on Ubuntu)
Using Certbot as the CA I have a file:
/etc/apache2/sites-available/nr-server3.com-le-ssl.conf

Inside the File: (anonymized)

<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com


        SSLProxyEngine On
        ProxyPreserveHost On
        ProxyRequests Off



        ProxyPass /admin/comms wss://localhost:1880/admin/comms
        ProxyPassReverse /admin/comms wss://localhost:1880/admin/comms

        ProxyPass / https://localhost:1880/ connectiontimeout=5 timeout=30
        ProxyPassReverse / https://localhost:1880/

        ServerAdmin webmaster@nr-server1.com
        ServerName nr-server1.com
        ServerAlias nr-server1.com

        DocumentRoot /var/www/nr-server1.com/public_html
   
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/nr-server3.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nr-server3.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Further:

I've had issue with what I listed above and it started out with the WSS connection issues. I seem to have the /admin/comms/ part correct in the Apache settings, because now it doesn't complain about wss disconnection.

But I cannot get the Inject node to work in the IDE, and Dashboard /ui is console complaining that it cannot load: GET https://nr-server3.com/ui/loading.html 404 (Not Found) , Which displays some elements, but the buttons are not working.

At this point I'm thinking some setting in the Apache2 /etc/apache2/sites-available/nr-server3.com-le-ssl.conf are not working, in relation to routing the wss essentials / endpoints / or whatever it needs.
and possibly my NR settings.js might need some adjustment as well... ?

I appreciate any assistance in clarifying this process of essentially turning NR into a fully working "Virtual Host" behind Apache2, with wss, and my case scenario where I am serving NR httpStatic content in a different folder.

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