MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Issues enabling https on RP 4

    Scheduled Pinned Locked Moved Troubleshooting
    1 Posts 1 Posters 278 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pablousavilla
      last edited by

      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

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy