MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

Issues enabling https on RP 4



  • Hi all,

    I found myself working on my first Smart Mirror this week and I loved how easy it is to download new modules and have them running in no time.
    I was interested in enabling https by creating the certificates and changing the variable under config.js:

    useHttps: false -> useHttps: true

    Nevertheless I only got a black screen afterwards.

    I tried everything I could think of, but, being that Im not much of a programmer, it basically meant hitting the keyboard with one hand while having another coffee hoping that would do it.

    Eventually, I managed to find out that I could connect to the https://localhost:port via a browser, which made me realise the keyboard-hitting works… and that it was running… just not with electron.

    Well, tonight, after many an hour in front of this, I was able to get it to work, so I can narrow it down to the following:

    • Create your certificates correctly
    • Make sure you put the right address where they are located
    • Not enough coffee
    • There is a piece of code in electron.js that seems to be checking the wrong variable:

    // if (config[“tls”] !== null && config[“tls”]) {
    if (config.useHttps) {
    prefix = “https://”;
    } else {
    prefix = “http://”;
    }

    The line in “//” was commented out by me. I couldnt find much of a reference to tls anywhere.

    • Finally, as the certificate is self signed, these lines had to be added also to electron.js:

    app.on(‘certificate-error’, (event, webContents, url, error, certificate,
    callback) => {
    event.preventDefault();
    callback(true);
    });

    I hope it helps someone else!

    Thanks
    Regards
    JP


Log in to reply