0
votes

Following various posts about running Node-red as https, I've done the following:

Made the following changes in settings.js:

var fs = require("fs");

...

https: {
    key: fs.readFileSync('privkey.pem'),
    cert: fs.readFileSync('cert.pem')
},

...

requireHttps: true

Created privkey.pem and cert.pem.

Verified files exist in ~/node-red (Raspberry Pi).

Node.js version v8.9.4 Node-RED version v0.17.5

When I do https://raspberrypi:1880 I get "The site cannot be reached" but http://raspberrypi:1880 still works. I even tried rebooting the Pi.

1
Which settings file did you edit? Are you sure it's the one Node-RED is using? NR logs the settings file its using on startup, so worth double checking. - knolleary
Doesn't https protocol normally run on a different port? If http is already using 1880 i'd assume that port is already taken. - Brandon Miller
@BrandonMiller No, unless you change the port it will stay the same when you enable https. knolleary's suggestion that the wrong file has been changed is most likely - hardillb
@hardillb I've never heard of a TCP connection that allows for two different protocols to be listening on the same port at the same time unless there is some sort of proxy tunneling involved, which isn't truly the same port at that point. BUT, I've never used Node-RED so I'm sure you're right... Unless im misunderstanding and Node-RED is supposed to be disabling http in favor of https, which would make sense. - Brandon Miller
Ok. @knolleary. Nice to have another set of ...um eyes(?) ;) - I had two dirs .node-red and node-red (messing with different ways of installing node-red). Cleaned that up and modified the .node-red/settings.js and all good! Many thanks! FYI, when Node-red starts after changing https settings it starts on https ://127.0.0.1:1880 so look for http vs. https while starting. - John Smith

1 Answers

0
votes

This was a simple operator error. I had two dirs. One .node-red and one node-red (FYI: Only install node-red using one way and not several [duh]).

When node-red was loading I miss read the working directory and modified the wrong settings.js