# Apache2 websocket

**URL:** <https://discourse.nodered.org/t/apache2-websocket/55047>\
**Category:** General\
**Tags:** uibuilder\
**Created:** [11 December 2021 15:44 UTC](https://discourse.nodered.org/t/apache2-websocket/55047 "2021-12-11T15:44:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurijn](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Laurijn](https://discourse.nodered.org/u/Laurijn)\
**Post date:** [11 December 2021 15:44 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/1 "2021-12-11T15:44:35Z")

</div>

Hey

im a hobbyist and try to make my own secure webinterface for my home automation  
im stuck at my proxy i use apache2 and i have nodered working with websocket but i cant get it to work with uibuilder

this is what my error.log say  
[autoindex:error] [pid 25220] [client 82.163.40.94:60767] AH01276: Cannot serve directory /var/www/test/uibuilder/vendor/socket.io/: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive, referer: [https://test.domain.com/](https://test.domain.com/)

this is my feedback from chrome

 ![uibuilder fe](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7ed08d9b9d85023dc086c956bf0dd69e1e9dd16a.jpeg)  
 ![websocket](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/07ac445dd0d0325ac925b58774a4376bd312ff2d.jpeg)

and this is my apache2 config

```auto
  GNU nano 5.4 showcontrol.laurijnproductions.com-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin test@domain.com
        ServerName test.domain.com

        Documentroot /var/www/test/
        DirectoryIndex index.php

        <Directory /var/www/test>
                Options FollowSymLinks
                Allow from all
                Require all granted
        </Directory>

        ErrorLog /var/log/apache2/test/error.log
        CustomLog /var/log/apache2/test/access.log combined
        SSLProxyEngine ON

        <Directory "/var/www/test/uibuilder/vendor/>
                Options +ExecCGI +Indexes +FollowSymLinks -MultiViews
                Require all granted
                Allow from all
        </Directory>

        Define SocketURL "/nodered/"

                <Location ${SocketURL}>
                                RewriteEngine on
                                RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC]
                                RewriteCond %{HTTP:Connection} Upgrade$ [NC]
                                RewriteRule .*/(.*) "ws://localhost:1880/$1" [P,L]

                                ProxyPass http://localhost:1880/
                                ProxyPassReverse http://localhost:1880/
                </Location>

        Define NodeRedURL "/nodered/"

                <Location ${NodeRedURL}>
                                RewriteEngine on
                                RewriteCond %{HTTP:Upgrade} ^WebSocket$ [NC]
                                RewriteCond %{HTTP:Connection} Upgrade$ [NC]
                                RewriteRule .*/(.*) "ws://localhost:1880/$1" [P,L]

                                ProxyPass http://localhost:1880/
                                ProxyPassReverse http://localhost:1880/
                </Location>
        ProxyPreserveHost On
        ProxyRequests Off
        SSLCertificateFile /etc/letsencrypt/live/test.domain.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/test.domain.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

```

can someone help me with it

kind regardz  
Laurijn van den Heuvel

---

<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:** [11 December 2021 16:56 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/2 "2021-12-11T16:56:17Z")

</div>

> [@Laurijn](#):
>
> /var/www/test/uibuilder/vendor/socket.io/

THat is your problem. You have set Apache to deliver from a fixed filing system location whereas Node-RED (via uibuilder) already serves that. If you wanted to do it that way, you would need to put the [Socket.IO](http://Socket.IO) client library in that folder. But I don't recommend that since the client and server libraries need to be the same version or they may not work. So you really don't want to be manually managing that (unless you do for some reason).

Simply follow the instructions that are around somewhere for using Apache as a reverse proxy for Node-RED and everything should work as expected.

---

<div class="post-metadata">

**Author:** ![Laurijn](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Laurijn](https://discourse.nodered.org/u/Laurijn)\
**Post date:** [11 December 2021 17:53 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/3 "2021-12-11T17:53:40Z")

</div>

thank you for reaction what i want to do is that if i go to my domain [test.domain.com](http://test.domain.com) that i landing on the webinterface whitout that i have to do [test.domain.com:1880/something](http://test.domain.com:1880/something)

---

<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:** [11 December 2021 17:56 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/4 "2021-12-11T17:56:12Z")

</div>

Yup, loads of info on how to do this out on the web. I don't use Apache so I won't attempt to repeat it here.

[https://www.google.com/search?q=node-red+apache+reverse+proxy&oq=node-red+apache+reverse+proxy](https://www.google.com/search?q=node-red+apache+reverse+proxy&oq=node-red+apache+reverse+proxy)

---

<div class="post-metadata">

**Author:** ![Laurijn](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@Laurijn](https://discourse.nodered.org/u/Laurijn)\
**Post date:** [11 December 2021 17:58 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/5 "2021-12-11T17:58:47Z")

</div>

Thank you for the information

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 February 2022 17:59 UTC](https://discourse.nodered.org/t/apache2-websocket/55047/6 "2022-02-09T17:59:08Z")

</div>

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