# Connectivity issue with Node-Red behind HTTPD

**URL:** <https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813>\
**Category:** General\
**Created:** [4 May 2019 16:35 UTC](https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813 "2019-05-04T16:35:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utundu](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Utundu](https://discourse.nodered.org/u/Utundu)\
**Post date:** [4 May 2019 16:35 UTC](https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813/1 "2019-05-04T16:35:33Z")

</div>

Hi,

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

```auto
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/](http://localhost:1880/)  
> ProxyPassReverse / [http://localhost:1880/](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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 May 2019 16:58 UTC](https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813/2 "2019-05-04T16:58:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [4 May 2019 17:22 UTC](https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813/3 "2019-05-04T17:22:54Z")

</div>

I'm curious: why httpd ?

---

<div class="post-metadata">

**Author:** ![Utundu](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Utundu](https://discourse.nodered.org/u/Utundu)\
**Post date:** [4 May 2019 21:41 UTC](https://discourse.nodered.org/t/connectivity-issue-with-node-red-behind-httpd/10813/4 "2019-05-04T21:41:38Z")

</div>

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:

```auto
<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 🙂 !
