Hass.io and node red get 502: Bad Gateway

Hi,

I am using hass.io and node red from the Community Hass.io Add-ons.

When i install or reinstall it, it works short time and then i get 502: Bad Gateway

image

Attached my settings for Node red:

And My docker:

What can be the issue? it works like this before… the only change that i see
that in the past in the node red settings i need to set port and here no…

1 Like

Same issue here. When I set the network to 1880 and connect with incognito, i get a username/password prompt. However no credentials are working.
Nothing in Developer -> Local Storage.

Up… no one has this issue and solution ? :frowning:

This is because of the ‘Ingress’ update. The ports have been disabled.
You can either open it up from the add on ‘Open Web UI’ and, as of the latest HA update, also add to side bar from the add on config

Hi @apmillen

1- I have the most updated HASS.IO and NODE RED
2- It happened after fresh install (format and fresh linux + HA + DOCKER install)
3- i use the open web UI - The same
and the side bar …

still get the error

I think the issue is with the NGINX add on, now without NGINX
it working (after fresh install).

:frowning:

1 Like

i dont have NGINX installed. However still shows up in the NodeRed log:
[21:57:05] INFO: Starting NGinx…

What you using for login to HA out from the network ?

I am using nebu casa.

I can get nodered working, if I uninstall nodered addon. Remove the nodered diriectory. Reboot.
Install nodered.
I then get the interface back without issue.
I can import my flows, but as I start to install the nodes, at some point nodered will hang, and I will not be able to get the interface back. It usually happen during the last node install.

I have also tried not importing my flows, and just start to install the nodes. It still crashes at some point. Its not a specific node, as I have tried to change the order.

The dependencies are:
“name”: “node-red-project”,
“description”: “A Node-RED Project”,
“version”: “0.0.1”,
“private”: true,
“dependencies”: {
“node-red-contrib-better-sonos”: “~0.1.21”,
“node-red-contrib-broadlink-control”: “~1.0.6”,
“node-red-contrib-cast”: “~0.2.6”,
“node-red-contrib-google-home-notify”: “0.0.7”,
“node-red-contrib-light-scheduler”: “0.0.12”,
“node-red-contrib-schedex”: “~1.5.1”,
“node-red-contrib-sonos”: “~0.1.0”,
“node-red-contrib-telegrambot”: “~5.5.0”
}
}

my third attempt installing home assistant and the third time I run into this problem with nodered. everything else is happy.
It stopped working after I started installing vnc and monitoring etensions, but I can’t tell if that’s related.

[edit]
well blow me down. I looked at the nodered addon logs in hassio, and it said

17 May 16:46:18 - [info] Started flows
17 May 16:46:18 - [info] [mqtt-broker:hassio mqtt broker] Connected to broker: xxxx
17 May 16:46:18 - [info] Server now running at http://127.0.0.1:xyz/
[16:46:18] INFO: Starting NGinx…

sure enough, navigating to localhost:xyz brought up nodered. all nice and shiny. At least I can get to it again - but in a rather ugly way.

i’m also seeing lots of logs of connects and disconnects to http://hassio/homeassistant which is not something I set up on my local network, but maybe that’s what NodeRed needs NGinx for.

I am seeing the same behavior since updating to a Node-Red release with Ingress.

My existing flows all work, I just cannot access the interface at all to be able to edit them.

Attempted to change hostname/DNS entry from homeassistant.local.dom to hassio.local.dom to match what the hostname in the error logs show. Still no dice.

Here is the error I am seeing in the hass.io log section:

19-05-20 14:50:50 ERROR (MainThread) [hassio.api.ingress] Ingress error: Cannot connect to host 172.30.32.1:62498 ssl:None [Host is unreachable]

To me this seems like the host doesn’t know about the internal network of 172.30.32.x which is the docker network “hassio”
Node-Red is running on host level networking.

But if I check the static routes internally, they are all there.

[root@hassio ~]# route -n                                                                                                                                                                                   
Kernel IP routing table                                                                                                                                                                                     
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface                                                                                                                               
0.0.0.0         10.0.1.1        0.0.0.0         UG    100    0        0 enp3s0f0                                                                                                                            
10.0.1.0        0.0.0.0         255.255.255.0   U     100    0        0 enp3s0f0                                                                                                                            
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0                                                                                                                             
172.30.32.0     0.0.0.0         255.255.254.0   U     0      0        0 hassio

I’ve been having the same “Bad Gateway” prob for a while. i think i (or … uh… it) fixed it(self).
when you click on the “START” button the first time, it takes a minute or two for the UI to fully get set up and loaded. BUT, there is no “please wait” prompt to tell you that. so i kept clicking on the “OPEN WEB UI” button right away and getting the “Bad Gateway” screen.
there were no errors on the log that i could see.
BUT
when i finally went down and “Refreshed” the log after i clicked “Start” i noticed the log getting longer and longer. eventually the entries stopped and THEN when i clicked on the “OPEN WEB UI” button - my Node-Red screen came up right away!!!
it seems that towards the end of the log entries there’s an entry for “Starting Node-RED”
Even after that there is one that reads: “Starting NGinx…”
then next entry seems to be the end of the startup logging. this is when i can open my node-red UI.
hope this helps, 'cause i was running in circles for a long time.
Russ from Coral Springs, Florida

4 Likes

I updated to version 3.1.1 and now I’m getting 502 Bad Gateway error. What can I do to get my Node Red back??

When I attempt to open Node Red in Firefox (vs Safari), I get a 401: Unauthorized error instead of the 502: Bad Gateway error in Safari.

Is there a way to get to rollback Node Red?

Anybody else having this issue? Node-red was working without issue after I re-installed everything, and now after updating to the latest version, I’m getting the 502 error again. Also, my NR flows are not working.

I was having this issue until I actually looked at the logs…

  • first of all it highlighted that I hadn’t set the username, password, or credential… so I set those and it still didn’t work
  • then it highlighted that it was looking for an ssl certfile which didn’t exist… so I set the ssl in the config to false… and it still didn’t work
  • then I refreshed the logs a few times while it actually loaded (it’s not instantaneous) and when it showed it was running, I opened the UI and it was all working fine!
2 Likes

I have been going through this same thing for a few days.
Hassio in docker (ubuntu server 18.04)
Version 0.94.1

Installed NodeRed through the Add-On Store
Setup the Credential Secret
Setup http_node username and password
Setup http_static username and password
setup ssl certfile and keyfile

restart NodeRed and try to open with Sidebar (tries for a bit then 502: Bad Gateway)
Try to open with Open Web UI, again tries for a bit, then 502: Bad Gateway.

I access my HA through https://MYDOMAIN.duckdns.org:8123
I read on another post (not sure where now) that going directly to the IP address of the HA instance fixes it.
I accessed with https://MYIP:8123 and tried to open through the sidebar, and through the Dashboard “Open Web UI” Both still gave me the 502: Bad Gateway.

I then tried accessing with https://MYIP:1880 (1880 is the port i have set in the NodeRed Settings) and it came up just fine.

This is still a roundabout way of getting there, one I’m not very pleased with, but at least it “working” doing this.

Same issue after a new hassio install on Ubuntu 16.04 in a docker container.

Both ESPHome and NodeRED fail to load via ingress. I can get to both of them through the direct URL and port.

I used Frenck’s script to install hassio which worked well, except for this annoying problem.

I’ve been having this for weeks but I’ve finally fixed it. ip:1880 worked, but not through NGinX reverse proxy. I had my firewall setup incorrectly. My fix:

you may already have a rule for port 1880 in place, but I suggest you remove it and simply add it again.

sudo ufw status numbered

gives a list of firewall rules with a number, e.g.

(1) 8123 allow anywhere
(2) 443 allow anywhere
(3) 1880 allow anywhere 1880

we want to kill the rule for port 1880

sudo ufw delete 3

setup the correct rule:

sudo ufw allow 1880

restart the firewall:

sudo disable ufw && sudo enable ufw

whoop.
oh, and you need to enter port 1880 to the hassio > nodered addon > Network > host field to make it work outside of ingress.

ha dthe error too after updating NodeRed and strting manually. You see a couple of errors in the log:
19-10-06 09:37:47 ERROR (MainThread) [hassio.api.ingress] Ingress error: Cannot connect to host xxx.xxx.xx.x:62695 ssl:None [Connection refused]

Just waited a couple of minutes and then try again.