How to connect to nodered using raspberry pi hostname

Goal:
I would like to allow users to just type into their browser: <hostname> and automatically be directed to the nodered dashboard app I made.

Progress so far:
Nodered is running on a raspberry pi. I already changed my hostname, I have a static IP, and I added an entry of this static IP with my hostname to /etc/hosts.

I can ping <hostname> on my raspberry pi and get a response but I cannot ping that hostname from any other computer on the network and get a response.

Will it even be possible to append :1880/ui to my hostname so users do not have to type that in?

Thanks for the help.

I just found I can enter: hostname.local:1880/ui and that works!

However, is there a way to get rid of the .local:1880/ui? Maybe that involves something fancier like setting up a server to route traffic?

Hi @cuxcrider

When a browser is pointed at <hostname> it will attempt to access port 80. Via your Node-RED settings file you can change what port NR listens on. But for it to listen on port 80 as a normal user you will also need to grant it permission to do so. This SO post explains what to do - https://superuser.com/questions/710253/allow-non-root-process-to-bind-to-port-80-and-443 - you need to identify the path to the node binary by running which node - I can't remember where it is on a Pi install.

That will get you as far as <hostname>/ui to access the dashboard.

In the settings file you can uncomment the line for httpAdminRoot to move the Node-RED editor away from / - for example, set it to /admin. Finally, uncomment the ui setting and change the ui value to /.

Restart Node-RED and you should be there.

thanks, that was perfect and it's up and running.

To truly use just <hostname> I had to add a dns entry on our local server, but otherwise everything could be done on the pi.

The .local is typically provided by either your router or by Apple's Bonjour protocol running on the Pi.

There are doubtless several ways to get rid of it but all are relatively involved. For example, in order to make best use of Let's Encrypt, on my Pi I actually use a full domain name like pi.something.co.uk. This is set up on my router which allows such things - not all of them do.

I have following Question and i would be thankfull if you could help me. My aim is to created an Raspi image with Node Red on it. And everyone in the World can flash it on the sd and use my node-red webside. To call the webside i want an domain so everybody can call the same local webside. The question ist nearly the same like cuxcrider had. I have an Raspi where node-red is running to access to my Website i use 192.168.0.24:1880/ui/ with your help i could manage to remove the :1880. Now i can access it via 192.168.024/ui/. To remove the ui i uncommented the httpAdminRoot -> httpAdminRoot: '/admin', so far so good. Now i wanted to uncomment the ui setting the online one i found was something like ui = path { "ui"] i changed ist to "/" like you said but after it i cant access to the webside. Do you know what im doing wrong? Can i also using an domain like webside.test when i write it in the /etc/host, so every user in the same network just write webside.test and not 192.168.0.24 (IP Raspi). Hope i could explain my question understandable.

As answered on Stack Overflow

Running Node-RED on port 80 is a bad idea because it means running as root. You should NOT do this unless you are fully aware of the security implications.

Mapping an IP address to a host name will probably mean running your own DNS which is not a simple thing to explain here and will be heavily dependent on how your network is setup. Editing the /etc/hosts file on the pi will have no effect on any other machine on your network.

Thank you for your second anwser. Now i understand that it is not as easy as i thought. Have a nice Day

Ah, I see that you already handled this in the SO answer - sorry Ben.

There are certainly several ways to avoid the root problem.

  • Use systemd to give access to port 80 without needing root.
  • Use a front-end reverse proxy to expose port 80 but proxy to a port >1024 for node-red. This will generally be the preferred solution in any case both for performance reasons and for added layers of security.