Nodered Subpath for use with Traefik Proxy PathPrefix

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/..

Thanks,

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.

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/..

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.

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.

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