# Node-RED, Apache,Proxypass - no debug data

**URL:** <https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411>\
**Category:** General\
**Created:** [2 December 2018 16:31 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411 "2018-12-02T16:31:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bronto](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bronto](https://discourse.nodered.org/u/bronto)\
**Post date:** [2 December 2018 16:31 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/1 "2018-12-02T16:31:24Z")

</div>

Hey All,

Issue: debug node dosn't work - no debug data

I have got an issue after securing Node-RED by Apache web server with ProxyPass and uiHost:127.0.0.1,  
adminAuth.

1. What I have:

- Ubuntu 18.04, Apache, SSL certyficates, Proxypass,ProxyPassReverse to [http://localhost:1880/](http://localhost:1880/)

[Issue]  
When I run Node-RED in browser locally: localhost:1880 then evrything works.  
Into flows, debug nodes works (debug data are retrived in debug panel), mqtt and mysql shows that they are connected.  
But when I run Node-RED in browser on WAN site e.g [https://io.company.com/](https://io.company.com/)  
I could login to Node-RED, I see running flows - database accepts data from mqtt.  
The problem is - debug node dosn't work (nothing shows in debug panel), mqtt node dosn't show that there is connected,also mysql node dosn't show that there is connected.

Did I omit something in the configuration?

Best regards.  
Bronto

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 December 2018 16:40 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/2 "2018-12-02T16:40:56Z")

</div>

the websocket connection back to the editor (debug) also needs to be allowed through your proxy.

---

<div class="post-metadata">

**Author:** ![bronto](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bronto](https://discourse.nodered.org/u/bronto)\
**Post date:** [4 December 2018 20:38 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/3 "2018-12-04T20:38:55Z")

</div>

@dceejay - I thank You  
I have done some research on the web, and found out some informations about RewriteCon for websocket. I have implemented that solution and now, my Node-RED debug node works in proxy.

Best regards  
Bronto

---

<div class="post-metadata">

**Author:** ![dustinw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dustinw/32/3426_2.png) [@dustinw](https://discourse.nodered.org/u/dustinw)\
**Post date:** [6 December 2018 22:06 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/4 "2018-12-06T22:06:39Z")

</div>

@bronto any chance you could post a sanatized version of your Apache config? It would be useful as a reference.

---

<div class="post-metadata">

**Author:** ![bronto](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@bronto](https://discourse.nodered.org/u/bronto)\
**Post date:** [10 December 2018 12:25 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/5 "2018-12-10T12:25:13Z")

</div>

OK - I could, no problem.

1. There's a popout on that forum which tells us about security of Node-red.

Shortly - OS Ubuntu, Node-Red runs by tux user.  
Tux home directory: /home/tux/.node-red/settings.js.  
Three important parameters

```
uiPort:process.env.PORT || 3005,
uiHost:"127.0.0.1",
httpAdminRoot:'/nodered',

```

And now

1. Apache virtual host setup (SSL by letsencrypt)

 ServerName example.com ServerAdmin you@example.com DocumentRoot /var/www/html/example.com

```
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /nodered(.*) ws://localhost:3005/nodered$1 [P,L]

ProxyPreserveHost On
ProxyRequests Off
ProxyVia Off

<Proxy *>
    Order deny,allow
    Require all granted
</Proxy>

ProxyPass /nodered http://localhost:3005/nodered
ProxyPassReverse	/nodered http://localhost:3005/nodered

ErrorLog ${APACHE_LOG_DIR}/error-example.com.log
CustomLog ${APACHE_LOG_DIR}/access-example.com.log combined

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

```

Above configuration works for me.

Best regards  
Bronto

---

<div class="post-metadata">

**Author:** ![dustinw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dustinw/32/3426_2.png) [@dustinw](https://discourse.nodered.org/u/dustinw)\
**Post date:** [12 December 2018 21:52 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/6 "2018-12-12T21:52:21Z")

</div>

Awesome, thanks @bronto !

I currently have my http end points all proxied via Apache, but it would be nice to proxy the admin interface as well!

---

<div class="post-metadata">

**Author:** ![hjellmarr](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@hjellmarr](https://discourse.nodered.org/u/hjellmarr)\
**Post date:** [21 March 2019 20:33 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/7 "2019-03-21T20:33:37Z")

</div>

Hi,

I am having trouble dealing with the websocket connection with two Node Red instances: one local and another one on different Raspberry Pi in same private network. I had my local device (the one with Apache running) setup working by following this and [this](https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel) discussion. Here is my Apache Virtual Host configuration for all 443 traffic:

```auto
<IfModule mod_ssl.c>
<VirtualHost *:443>

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /node1(.*) ws://localhost:1234/node1$1 [P,L]

ProxyPreserveHost On
ProxyRequests Off
ProxyVia Off

<Proxy *>
    Order deny,allow
    Require all granted
</Proxy>

# This is the first (local) node-red instance, works well with the Rewrite lines above
ProxyPass /node1 http://localhost:1234/node1
ProxyPassReverse /node1 http://localhost:1234/node1

# This is the second node-red instance running on another Pi, ProxyPass works but websockets do not
ProxyPass /node2 http://192.168.x.x:1234/node2			
ProxyPassReverse /node2 http://192.168.x.x:1234/node2

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

```

I have learned that I could separate the websockets by custom paths like this:

```auto
Node server:

var io = require('socket.io')({ path: '/ws_website1'}).listen(server);

Client HTML:

<script src="/ws_website1/socket.io.js"></script>
...
<script>
var socket = io('', { path: '/ws_website1' });
...

```

I am guessing that I should edit my node modules to make this happen, but I have no idea which one to look at. Any help would be greatly appreciated.

Thank you!  
Hjellmarr

---

<div class="post-metadata">

**Author:** ![Eckehard\_070](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eckehard_070/32/53691_2.png) [@Eckehard\_070](https://discourse.nodered.org/u/Eckehard_070)\
**Post date:** [24 January 2020 14:47 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/8 "2020-01-24T14:47:19Z")

</div>

Hy all,

I am running node-red with https enabled (see [http://www.steves-internet-guide.com/securing-node-red-ssl/](http://www.steves-internet-guide.com/securing-node-red-ssl/)) and wanted to proxie it from another account. Let say, NR is running at my.server1:1880.

There is a second server exposed via DNS at my.server2, and I wanted to use this adress for node-red (without :1880). This server is running Debian10 and a clean installation of Apache 2, ssl certificates from Letsencrypt.

Finally I managed to get node-red running without any rewrites.

I set /root/etc/apache2/sites-available/000-default-le-ssl.conf:

```auto
<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	ServerName my.server2
	
	SSLProxyEngine on

    #ProxyPreserveHost On
    ProxyRequests Off

	ProxyPass /comms wss://my.server1:1880/comms
	ProxyPassReverse /comms wss://my.server1:1880/comms

	ProxyPass / https://my.server1:1880/
    ProxyPassReverse / https://my.server1:1880/
   
	SSLEngine on
	SSLCertificateFile /etc/letsencrypt/live/my.server2/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/my.server2/privkey.pem
	Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

```

Hope this can help someone to get things running. **wss://my.server1:1880/comms** seems to be necessary to get websockets running.

---

<div class="post-metadata">

**Author:** ![gbruneau](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@gbruneau](https://discourse.nodered.org/u/gbruneau)\
**Post date:** [21 November 2020 07:38 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/9 "2020-11-21T07:38:00Z")

</div>

Thank you, this works great! Took me a while to figure it out because not all the required apache modules were loaded. I had to run enable proxy, proxy\_http, and proxy\_wstunnel. Sharing in case others have the same issue.

sudo a2enmod proxy  
sudo a2enmod proxy\_http  
sudo a2enmod proxy\_wstunnel

---

<div class="post-metadata">

**Author:** ![Eckehard\_070](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eckehard_070/32/53691_2.png) [@Eckehard\_070](https://discourse.nodered.org/u/Eckehard_070)\
**Post date:** [7 January 2022 07:51 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/10 "2022-01-07T07:51:09Z")

</div>

Strange enough, i recently had to change my setup to add a second node red server to the setup. You can use

> ProxyPass /nodered1/

to use a different path, But for whatever reason, websockets are working only on one of the servers, while the second dores not have any debug messages in node red.

I assume there is some misconfiguration somehow, but it seems this kind of trouble is not uncommon for Apache. Found a similar case on the net. After changing to ngix things seemed to work better...

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 January 2022 09:02 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/11 "2022-01-07T09:02:03Z")

</div>

Yes, NGNX is a much better web server. Typically uses a lot less resources than Apache as well. Caddy is also quite good.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [10 January 2022 14:43 UTC](https://discourse.nodered.org/t/node-red-apache-proxypass-no-debug-data/5411/12 "2022-01-10T14:43:24Z")

</div>

When using nginx, I always add some conf settings like this, to enable websockets:

```auto
        location / {
            proxy_pass http://localhost:1880/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Real-IP $remote_addr;
        }

```
