# Nodered Subpath for use with Traefik Proxy PathPrefix

**URL:** <https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039>\
**Category:** General\
**Tags:** docker\
**Created:** [30 January 2024 10:10 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039 "2024-01-30T10:10:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Con1924](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/con1924/32/85266_2.png) [@Con1924](https://discourse.nodered.org/u/Con1924)\
**Post date:** [30 January 2024 10:10 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039/1 "2024-01-30T10:10:05Z")

</div>

Is there a way to edit the nodered subpath URL? Ideally with docker compose environment variables.

I'm use Traefik and want to expose nodered using PathPrefix

So nodered would be available at [subdomain.domain.com/nodered/](http://subdomain.domain.com/nodered/)..

Thanks,

---

<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:** [30 January 2024 12:07 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039/2 "2024-01-30T12:07:00Z")

</div>

Sorry, not totally understanding your question.

Is it the subdomain you want to customise or the path?

If the path, then yes it is possible in the node-red settings.js file. But of course, since node-red is on its own PORT, and only 1 service can control 1 port, the path for node-red itself - when run behind a proxy - is of little consequence. The proxy controls (can control) the path as seen by the outside world.

If you could clarify what you are trying to achieve, we can probably help further.

---

<div class="post-metadata">

**Author:** ![Con1924](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/con1924/32/85266_2.png) [@Con1924](https://discourse.nodered.org/u/Con1924)\
**Post date:** [31 January 2024 19:07 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039/3 "2024-01-31T19:07:21Z")

</div>

So I have a docker stack that we host as `customer.ourdomain.com`  
So each customer gets a subdomain. Then I want to host each service, Nodered, Grafana, MQTT, Influxdb ect as `customer.ourdomain.com/service`  
For example in Grafana, I have to pass some docker env vars to grafana for it's basepath to be `customer.ourdomain.com/grafana/..`  
At least for Grafana, if I don't tell Grafana the new basepath it redirects to `customer.ourdomain.com/login` which doesn't match my traefik rules and so doesn't load the page.

I'm wanting to do the same for NodeRed.  
So I can access the editor at `customer.ourdomain.com/nodered/..`

---

<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:** [31 January 2024 20:28 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039/4 "2024-01-31T20:28:32Z")

</div>

> [@Con1924](#):
>
> For example in Grafana, I have to pass some docker env vars to grafana for it's basepath to be `customer.ourdomain.com/grafana/..`  
> At least for Grafana, if I don't tell Grafana the new basepath it redirects to `customer.ourdomain.com/login` which doesn't match my traefik rules and so doesn't load the page.

So is Traefik external to the docker stack? I assume it is.

Can we then assume that your docker stack presents each instance on its own internal IP address? I don't use Docker extensively so I'm not sure?

Again, assuming that each docker instance has its own IP address and therefore can use the default ports for Grafana and Node-RED, etc. Then the proxy can take each and map the ip/port/path combination to any other valid address/port/path. That is just a matter of configuring the proxy when adding new docker instances.

I can't give you specifics as I don't use Traefik. But mapping `https://ip1:3000/` for example to `https://customer1.ourdomain.com/grafana/` should be easy to do. The login endpoint would then be `https://customer1.ourdomain.com/grafana/login` though if you wanted to, you could also remap that as well in the proxy.

> [@Con1924](#):
>
> I'm wanting to do the same for NodeRed.  
> So I can access the editor at `customer.ourdomain.com/nodered/..`

For node-red, I would recommend changing your standard settings.js to use `https://ip1:1800/admin` or some such path for the Editor and avoid the default simply because it makes it harder to accidentally end up on the wrong endpoint. Then use your proxy to map that however you like. Again though, I would personally avoid leaving the Editor as the default path. E.g. I wouldn't want the editor on `https://customer1.ourdomain.com/nodered`, I'd want to put some kind of default page there and have the Editor on something like `https://customer1.ourdomain.com/nodered/admin`. But of course, you can map things however you like.

---

<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:** [30 April 2024 20:28 UTC](https://discourse.nodered.org/t/nodered-subpath-for-use-with-traefik-proxy-pathprefix/85039/5 "2024-04-30T20:28:56Z")

</div>

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