Windows SSL Certificate

Sorry noob here....

Been using NodeRed on my Windows machine for ages now and all been good. But I now need to expose it to the big wide internet so need to make sure I have SSL enabled. However I cannot get it to work and have been trying for weeks now.

Does any one know of a walk through I could follow?

If not my attempts are around using CertifyTheWeb client to generate certificates which seems to all go well. I save them in a certs folder in my .nodered directory and update the config file. However when I go to restart NodeRed it just instantly crashes.

Totally stuck!

    /** Option 1: static object */
    https: {
      key: require("fs").readFileSync('C:\Users\HT\.node-red\certs\privkey.pem'),
      cert: require("fs").readFileSync('C:\Users\HT\.node-red\certs\fullchain.pem')

\ is an escape character in JavaScript strings so you need \\. But easier is to use / instead which windows is perfectly happy with. Even better is to use the path library which is native node.js e.g. path.join(os.homedir(), 'folder1', folder2', 'fullchain.cer'). That sorts out paths for you, works across different OS's and even takes care of relative paths and . or .. mixed in.

1 Like

Thank you! Can confirm that fixed it

Appreciate you taking the time to answer as I would have been there forever figuring that one out.