# Not quite understanding how httpAdminRoot works

**URL:** https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097
**Category:** General
**Created:** [31 January 2024 23:07 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097 "2024-01-31T23:07:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [31 January 2024 23:07 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097/1 "2024-01-31T23:07:48Z")

</div>

Hi folks,

I need to do a lot of catching up from other discussions, but first I need to finish an issue with my overal Node-RED setup...

I need to setup a (Tailscale) reverse proxy that exposes Node-RED at some path "my\_root". So when I navigate to `http(s)://my_host_name/my_root`, the Node-RED flow editor should be displayed.

Since I am by far a specialist about this kind of thing, I would really appreciate if somebody could enlighten me!

## First attempt - without httpAdminRoot

So the flow editor runned originally at the base path. Which means I configured my reverse proxy like this:

```auto
http://my_host_name/my_root --> http://localhost:1880

```

When I navigate to `http://my_host_name/my_root` the Node-RED html page is being fetched from the base path ([http://localhost:1880](http://localhost:1880)) without problems:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/decdea4155200367c31a84b93d63ad3191b45e27.png)

However none of the other files can be found, because those requests go to the base path of my proxy (`http://my_host_name/red/...`), while my proxy is listening only to requests to my\_root (`http://my_host_name/my_root/red/...`):

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1489212ccdb4a99e595bf7efb1ef85c4e0f054f.png)

So the proxy has no idea what to do with those requests.

## Second attempt - with httpAdminRoot

Since Node-RED should get all these files from my\_root to solve this, I thought I should adjust the httpAdminRoot in my settings.js file:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb7adbd191ab8e5eb0ca768c6b90309d9ff7b49a.png)

When I navigate now to `http://my_host_name/my_root` the Node-RED html page cannot be fetched anymore, since that is now being served at my\_root:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/433613527828b62e581440d357e47e690fcb8a95.png)

So I thought that I could solve this by changing my reverse proxy, so that I get redirected to my\_root (where the html is being served):

```auto
http://my_host_name/my_root --> http://localhost:1880/my_root

```

And then indeed I can fetch the Node-RED html page from my\_root, but the other files still cannot be fetched:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/8746f35cb82950627f9d6a6b22c7bea3910b7607.png)

For some reason those files are _ **NOT** _ being fetched from `http://my_host_name/my_root/red/...` but from the base path ( `http://my_host_name/red/...`). _ **I thought that all files would be served under httpAdminRoot?** _

Thanks for reading!!  
Bart

---

<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: [1 February 2024 01:28 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097/2 "2024-02-01T01:28:14Z")

</div>

Not familiar with Tailscale, can only really comment on NGINX.

I always move the editor to `/red`.

I proxy the `/` path to `https://localhost:1880/` simply because I don't need to run any other none node-red endpoints on this server and then have a sub-location of `/red/` (note the trailing slashes, they tend to be important for proxying) which is where I proxy websockets as well.

A separate `/red/ui` sub-location (`https://my.public.domain/red/ui/`) is proxied to `http://localhost:1880/ui/` for dashboard. I can do the same for any UIBUILDER endpoints as well of course.

I should say that I don't actually need to proxy anything on my home server since anything externally accessible actually goes through Cloudflare Zero Trust but it is useful to have some kind of working config for questions like this.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [1 February 2024 12:16 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097/3 "2024-02-01T12:16:33Z")

</div>

Hey Julian,

Really appreciate your input! It gives my brain some food to think about...

During my lunch break, I had a quick discussion with chatgpt about this. Summarized:

1. I set my httpAdminRoot:

2. So now my initial html file is available at `http://localhost:1880/my_root`

3. When I now navigate to `https://my_tailscale_hostname/my_root` I can fetch my Node-RED file which contains a bunch of _ **relative file paths** _ (i.e. they don't start with '/'):

4. However these file paths can still not be accessed (http status 404). That is because the file paths are relative to the url. Which means the browser appends the relative URL to your current url. _ **But the browser appends the relative url to the last directory in your url, and omits filenames at the end.** _ So if you are for example navigating to `http://some_directory/some_file_name` then it will become `http://some_directory/some_relative_path` which means some\_file\_name is obviously ignored.

5. So I simply had to add a `/` at the end of my url, which means I now navigate to `http://localhost:1880/my_root/`. Now the relative paths will be appended to it like `http://localhost:1880/my_root/red/red.min.js`. And that works because thanks to the httpAdminRoot my file is located at that location.

I did not test yet if everything works fine, but this is quite promising...

Bart

---

<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: [1 February 2024 21:52 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097/4 "2024-02-01T21:52:36Z")

</div>

Phew, I thought you were going to make me think through all that proxy path stuff again - bad enough last night!! 😀

Yes, those pesky trailing slashes are a nightmare. So very easy to get wrong.

Glad you can move forwards.

---

<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: [15 February 2024 21:52 UTC](https://discourse.nodered.org/t/not-quite-understanding-how-httpadminroot-works/85097/5 "2024-02-15T21:52:43Z")

</div>

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