Search code examples
node-red

looking for an http-in node to handle ssl inbound web services


does anyone know of a replacement node for http-in for ssl? Thinking my only alternative would be to start nodejs as an https-server?

any suggestions would be great.

Thanks, Den


Solution

  • You don't need a replacement node (and I don't believe there are any as it would need to instantiate it's own HTTPS server independent from Node-RED), you just configure Node-RED to listen for HTTPS connections.

    How to configure Node-RED to listen on HTTPS is in the settings.js (found in the Node-RED user directory, which is normally ~/.node-red and is included in the first few lines of the Node-RED log)

    // The `https` setting requires the `fs` module. Uncomment the following
    // to make it available:
    //var fs = require("fs");
    ...
    // The following property can be used to enable HTTPS
    // See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
    // for details on its contents.
    // See the comment at the top of this file on how to load the `fs` module used by
    // this setting.
    //
    //https: {
    //    key: fs.readFileSync('privatekey.pem'),
    //    cert: fs.readFileSync('certificate.pem')
    //},
    ...
    

    More details can be found in my blog post here