Solving your 502 Gateway Error with the Node-Red add-on for Home-Assistant Supervised (Hassio)

Solving your 502 Gateway Error with the Node-Red add-on for Home-Assistant Supervised (Hassio)

Really quick post. As a result of my 3 part Beginner’s guide to Node-red tutorials, some have reached out to tell me that they’ve been unable to run Node-red successfully. They have installed the add-on from the “Home Assistant Community Add-ons” section which can be found in the side bar under Supervisor => Add-on Store (tab), but when they start the add-on, clicking on the link results in a 502 bad gateway error. In layman’s terms, this http error means the webserver has received a bad response and cannot move forwards. In reality, it’s either you’ve tried to access the add-on too early or it’s usually a password / auth issue. I’ve helped several people to address this. If you’re receiving a 502 issue, I would encourage you to wait a minute or so for the add-0n to finish loading itself (you can check the progress on the log tab of the add-on). If you are still experiencing the 502 after a couple of minutes, I suggest you do the following.

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:

A working configuration for the Node-Red add-on
A working configuration for the Node-Red add-on

Save the configuration and restart. It’s normally a good time to refresh the page (holding shift) or clear the cache in your browser forcing a clean retrieval. If all went to plan, you should be staring at a fresh Node-red page waiting for you to unleash your creativity. Hopefully this saves you some heartache!

If you enjoyed this type of content and would be interested in sharing your own solutions, tips and tricks with like minded people perhaps you’d consider joining our facebook group. The aim of this group will hopefully be more show and tell rather than support, but that’s not to say we can’t lend a helping hand 🙂

https://www.facebook.com/groups/386238285944105

Cheers!

The Smarthome Book
The Smarthome Book

 

Comments

  1. Is it actually “usually a password / auth issue”? I would say that 502 is usually a problem with not waiting long enough to allow NodeRed to restart after restarting Home Assistant, but it’s excellent that you’ve made a solution available for the more complex problem!

    Any ideas why some users face this problem?

    1. Hi Jonas, you raise a valid point about waiting, but in the recent experiences I had with others, they would repeatedly click on the link only to be met with the same issue, so it always seemed to me to be an access issue of sorts as opposed to being too keen. I think one of the things which is a little odd, is the use of the credential_secret as well as the password. I think this threw a fair few out. Clearing the browser cache normally came through at the end!

  2. Although the config looks different in my 2023.1.6 version, your article definitely helped me solve the problem! Thanks!

  3. Just found your post, at first using the UI I had issues (failed attempts) then found the edit in yaml. Changed the settings around and had to add some, saved. Then restarted. SUCCESS! Thank you, Thank you

Leave a Reply to Andrew HoweCancel reply