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"


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)


and those are symlinked to the Apache html folders:

/var/www/  <---- (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/',

Apache Configuration:
(Running on Ubuntu)
Using Certbot as the CA I have a file:

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.

        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/


        DocumentRoot /var/www/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

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


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 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/ 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.