Access Node-RED with IPC support

Hi all,

I would like to access Node-RED over a Unix Domain Socket, but the current implementation does not allow for this. Node.js' http(s) module has support for IPC (Net | Node.js v18.4.0 Documentation). I've played around with this a litte bit, and the following somewhat crude change did enable it, when placing a socket (like /var/run/node-red.sock) in uiHost configuration option of settings.js

> diff  node_modules/.bin/node-red node-red.bck
440c440,445
<             server.listen(settings.uiPort,settings.uiHost,function() {
---
>             let args;
>             if (settings.uiHost.startsWith('/'))
>                 args = [settings.uiHost];
>             else
>                 args = [settings.uiPort, settings.uiHost];
>             server.listen(...args,function() {

Has anyone tried something like this before? Is this possible out-of-the-box without any code changes?

The following configuration is working with Apache httpd (2.4.54):

<Location />
        ProxyPass unix:/var/run/node-red/sock|http://127.0.0.1/
        ProxyPassReverse unix:/tmp/nodejs.sock|http://127.0.0.1/
        RequestHeader set "X-Forwarded-Proto" "https"
</Location>
<Location /admin/comms>
        ProxyPass unix:/var/run/node-red/sock|ws://localhost/admin/comms
        ProxyPassReverse unix:/tmp/nodejs.sock|ws://localhost/admin/comms
        RequestHeader set "X-Forwarded-Proto" "https"
</Location>

Perhaps someone can make use of it. How can I create a feature request for IPC support in Node-RED?

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