# Expose only dashboard via nginx reverse proxy

**URL:** https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764
**Category:** Dashboard
**Tags:** nginx
**Created:** [24 August 2023 08:21 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764 "2023-08-24T08:21:34Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Slyke](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@Slyke](https://discourse.nodered.org/u/Slyke)
#### Post date: [24 August 2023 08:21 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/1 "2023-08-24T08:21:34Z")

</div>

Hello,

Is it possible to expose Nodered's UI Dashboard via an nginx reverse proxy? I want to have something like:

```auto
LAN:
192.168.1.10 <--- Nodered instance
192.168.1.10/ui <--- Nodered UI Dashboard
192.168.1.11/nodered <-- nginx reverse proxy pointing to 192.168.1.10/ui

Internet:
mydomain.com/my-nodered <-- nginx reverse proxy pointing to 192.168.1.10/ui exposed on internet (behind Authelia auth)

```

I understand that there's some websocket connections that happen between the UI and Nodered. Wondering if I can just expose the /ui folder directly and everything will still work?

---

<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: [24 August 2023 17:10 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/2 "2023-08-24T17:10:22Z")

</div>

Yes, you can do that, you just need to only proxy the `/ui` path. You will also need to proxy websockets though even for just the Dashboard because the ws connection is from the browser to Node-RED.

---

<div class="post-metadata">

### Author: ![Slyke](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@Slyke](https://discourse.nodered.org/u/Slyke)
#### Post date: [25 August 2023 09:36 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/3 "2023-08-25T09:36:51Z")

</div>

Thanks! Will give it a try once I've finished the flow, and paste my results here.

---

<div class="post-metadata">

### Author: ![Slyke](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@Slyke](https://discourse.nodered.org/u/Slyke)
#### Post date: [26 August 2023 08:35 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/4 "2023-08-26T08:35:52Z")

</div>

It works!

Here's the config I used:

```auto
  location ~/my-nodered/?(.*)?$ {
    if ($request_uri ~ /my-nodered$ ) {
      add_header Content-Type text/html;
      return 200 '<meta http-equiv="refresh" content="0; URL=$uri/" />';
    }

    # If not using Authelia, a cookie can be checked to use as "authentication". Comment out if not needed
    set $valid_cookie 0;
    if ($cookie_mySecretCookieName = "mySecretCookieValue") {
      set $valid_cookie 1;
    }
    # Redirect if cookie not set. Comment out if not needed
    if ($valid_cookie = 0) {
      return 302 https://my-domain.com;
    }

    # For websockets
    proxy_set_header Connection "upgrade";
    proxy_set_header Upgrade $http_upgrade;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    
    proxy_buffering off;
    proxy_pass_request_headers on;

    # Point to NodeRed:
    proxy_pass http://192.168.1.10;
    rewrite ^/my-nodered/(.*)$ /ui/$1 break;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    # Authelia configs:
    include conf.d/proxy.config;
    include conf.d/auth.config;
  }

```

Note that this is part of a larger config.

---

<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: [26 August 2023 12:30 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/5 "2023-08-26T12:30:32Z")

</div>

> [@Slyke](#):
>
> `Authelia `

How have I missed that! I'll be trying that out shortly - it might finally solve my end-to-end security example for uibuilder with NGINX as the proxy.

Thanks for sharing that, very useful.

---

<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 September 2023 12:30 UTC](https://discourse.nodered.org/t/expose-only-dashboard-via-nginx-reverse-proxy/80764/6 "2023-09-09T12:30:40Z")

</div>

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