Hass.io and node red get 502: Bad Gateway

Just had the same experience, I had to set password (used same as my user) and disable SSL. I went easiest possible path, my HA is not exposed to the world so I don’t care much.

Hello
I also had this problem and was looking for a solution without success. I was able to solve the problem.

Back up HAss
Uninstall Node-Red
I renamed the folder in the config / node-red directory at: config / node-red-old
I installed and configured Node-Red
Bad Gateway 502 … disappeared …
:laughing:
Delete directory… config/node-red-old

I had the same error.
When opening Node-Red with the WebUI, it works.
After that, it also works the normal way again.

This also fixed mine. Thank you @thecodemonkeyau

After changing the configuration of node_red like following:

‘’’
credential_secret: ‘!secret node_red’
dark_mode: false
http_node:
username: ‘’
password: ‘’
http_static:
username: ‘’
password: ‘’
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: true
system_packages: []
npm_packages: []
init_commands: []

‘’’

I had the same problem. However, if I click on Developer Tools -> Events -> Available Events, there is a nodered (1 listener) link. Clicking on that solves the problem for me

1 Like

This is the solution, I just had the same problem and now it’s solved.

So stop Node-Red, clear the logs, click on another item in the left menu, go to Supervisor, Node-Red and start. After 1 minute click on Open Web UI.

https://community.home-assistant.io/t/hass-io-and-node-red-get-502-bad-gateway/115328/12

1 Like

Thanks! that got me working too. Nice find!

This resolved my issue - Thanks

+1 to all the helpers that commented on this thread. I honestly didn’t believe those steps would work. Plus, Node-Red still opened separately in my browser window after starting it from terminal, but not in HA. Lo and behold, waiting that minute after doing everything before that worked! Thank you!

1 Like

Worked for me! Upvote!

Hi everybody, since the last update of HA, I have bad gateway error 502… with Node Red.

HA Version core-2021.4.4 on Raspbery PI4 32bit

I made a totally new installation and i have the same issue, I can open Node Red into HA or directly in Web UI but after some second, I have the message “Lost Connection” and after the connexion come back, and lost… it’s cyclic

See below the error:

> 21-04-14 18:21:52 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
> 21-04-14 18:21:52 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
> 21-04-14 18:21:52 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
> 21-04-14 18:21:52 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
> 21-04-14 18:21:58 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
> 21-04-14 18:21:58 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
> 21-04-14 18:21:59 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:01 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:03 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:05 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:07 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:13 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
> 21-04-14 18:22:13 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
> 21-04-14 18:22:13 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
> 21-04-14 18:22:13 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
> 21-04-14 18:22:13 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
> 21-04-14 18:22:14 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
> 21-04-14 18:22:19 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
> 21-04-14 18:22:19 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
> 21-04-14 18:22:21 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:23 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:25 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:27 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')
> 21-04-14 18:22:29 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 502, message='Invalid response status', url=URL('http://172.30.32.1:62597/comms')

Do you have any solution?

UPDATE: I found the problem, it’s was somes Nodes lost de relation between Home Assistant and Node Red, Node Red getting kicked by HA. I delleded all of my flows and creat a new relation… Now everything is ok

Thanks

Thank you.

This worked!!

Try this

Click on the conf tab of the Node-red add-on and basically paste this in. This is my configuration and it just works.

credential_secret: redacted but something difficult to guess
dark_mode: false
http_node:
username: redacted but same as HA login
password: redacted but same as HA password
http_static:
username: redacted but same as HA login
password: redacted but same as HA password
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: false
system_packages: []
npm_packages: []
init_commands: []

Now obviously, if you want dark mode or SSL etc., you’ll need to update this as required, but for now let’s try and get straight into node-red. Also some of this may or may not be necessary, but as I mentioned before, this just works for me. If you want to go through the full configuration options, you can check here: https://github.com/hassio-addons/addon-node-red/blob/master/node-red/DOCS.md

In order to preserve the correct lay out, here’s an example of it on the page:

1 Like

It works for me too. Thanks!

Strange shit the nodered settings.js missed a comma.

1 Like

I just about tried everything in this thread. Went back and saw this simple tip, and that solved it :slight_smile:

This resolved my issue too - Thanks

Thank you this resolved my issue 100%
From a TOTAL Newby

Thanks, you saved my day!