Connectivity issue with Node-Red behind HTTPD

Hi,

I'm having issues with my Node-Red setup.
I use Docker (compose) as described below:

nodered:
  image: nodered/node-red-docker:v8
  ports:
    - "1880:1880"
  net: "host"
  volumes:
    - "/disk1/config/nodered:/data"

httpd:
  image: "httpd"
  ports:
    - "80:80"
  volumes:
    - "./httpd/:/usr/local/apache2/conf/"
  net: "host"

NodeRed

<VirtualHost *:80>
ServerName nodered.MyDOMAIN
ProxyPass / http://localhost:1880/
ProxyPassReverse / http://localhost:1880/

When I go to my server directly and locally (192.168.1.2:1880) everything run smoothly.
But when I use nodered.MyDOMAIN:80, I can change my flows and deploy them, inject a timestamp for instance (I see the payload with the local address), but there seem to be an issue in the connectivity : I get a "Lost connection to server, reconnecting ..." after a few seconds, and, for instance, the debug console (with the domain name) won't show anything.
(I have a simple flow : I inject the timestamp to the debug)

This a plain installation, with nothing custom yet.
Any idea what could go wrong ?

Thanks for your help

You'll need to enable handling of websockets in your httpd config... if that's possible.

I'm curious: why httpd ?

Actually there is a bunch of other stuff on this server, including a web stack I use for a few tools.
It was there before I added the "smart home" part, including node-red and I figured, why not ...

@knolleary
I actually found something similar for Home Assistant. For node-red it would look like:

<VirtualHost *:80>
  ServerName nodered.myDOMAIN
  ProxyPreserveHost On
  ProxyRequests off
  ProxyPass /comms ws://localhost:1880/comms
  ProxyPassReverse /comms ws://localhost:1880/comms
  ProxyPass / http://localhost:1880/
  ProxyPassReverse / http://localhost:1880/

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)  ws://localhost:1880/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /(.*)  http://localhost:1880/$1 [P,L]
</VirtualHost>

Working great now, thanks :slight_smile: !