# Custom UI node cannot access changed path

**URL:** https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667
**Category:** Developing Nodes
**Created:** [1 April 2019 20:48 UTC](https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667 "2019-04-01T20:48:36Z")
**Posts on this page:** 4
**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: [1 April 2019 20:48 UTC](https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667/1 "2019-04-01T20:48:36Z")

</div>

Hi folks,

Got an issue on Github for my [node-red-contrib-ui-heatmap](https://github.com/bartbutenaers/node-red-contrib-ui-heatmap) node. After some discussions and digging into the code, it seems there are a few things incorrect in my node, but I'm running out of ideas ...

This is the second problem:

My heatmap UI widget [tries](https://github.com/bartbutenaers/node-red-contrib-ui-heatmap/blob/master/heat_map.js#L29) to load a javascript library **heatmap.min.js** (from the Node-RED server):

```auto
<script src="heatmap/js/heatmap.min.js"></script>

```

The server side will [return](https://github.com/bartbutenaers/node-red-contrib-ui-heatmap/blob/master/heat_map.js#L292) the **heatmap.min.js** as soon as a request arrives:

```auto
RED.httpNode.get('/ui/heatmap/js/*', function(req, res){

```

In my case this works fine, but the other user's dashboard couldn't load the case:

- In my case the request is http://.../ **ui** /heatmap/js/heatmap.min.js, which matches the required pattern and the file is loaded without problems.
- In the user's case the request is http://.../ **dashboard** /heatmap/js/heatmap.min.js which doesn't match, so it will never be redirected to the request handler...

The cause seemed to be that the user had changed the path (in the settings.js file) to '_dashboard_' instead of '_ui_':

```auto
// If you installed the optional node-red-dashboard you can set it's path
// relative to httpRoot
//ui: { path: "ui" },

```

Is there an easy way to support such custom paths? Should I remove the 'ui' from my path, or should I load the path from the settings and use it in my path automatically, or ... ?

Thanks !  
Bart

---

<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: [1 April 2019 21:21 UTC](https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667/2 "2019-04-01T21:21:28Z")

</div>

can't recall right this sec - but I think you have access to the `RED.settings` object so hopefully you may be able to grab the value you need.

---

<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: [4 April 2019 21:39 UTC](https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667/3 "2019-04-04T21:39:08Z")

</div>

> [@dceejay](#):
>
> can't recall right this sec - but I think you have

@dceejay,  
Don't be so modest...  
I can now confirm your brain is still functioning very well after all those long years 🧠

- By default the ui-path setting is in comment (in the **settings.js** file), and then I receive an undefined:

- And as soon as I specify my own path, it indeed becomes available:

So I use it now like this:

```auto
var uiPath = ((RED.settings.ui || {}).path) || 'ui';
RED.httpNode.get('/' + uiPath + '/heatmap/js/*', function(req, res){
   ...
}

```

Thanks a lot !!!

---

<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: [4 April 2019 21:44 UTC](https://discourse.nodered.org/t/custom-ui-node-cannot-access-changed-path/9667/4 "2019-04-04T21:44:48Z")

</div>

Tada ! - oh yes if not declared you would have to default it somehow... 🤕
