# Failed to get Https settings

**URL:** <https://discourse.nodered.org/t/failed-to-get-https-settings/79683>\
**Category:** General\
**Tags:** security\
**Created:** [10 July 2023 07:54 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683 "2023-07-10T07:54:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TROJAN053](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TROJAN053](https://discourse.nodered.org/u/TROJAN053)\
**Post date:** [10 July 2023 07:54 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/1 "2023-07-10T07:54:14Z")

</div>

HI,  
To secure my node red flow, I have incorporated SSL certificates in my node red settings. When i am using a self signed SSL certificate, node red is starting fine, but when i am using the SSL certificate created by my organization my node red is showing error failed to get https settings. I have uploaded the error codes in my most.  
Looking forward for solution.

 ![MicrosoftTeams-image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3cd432c3ac266abc7d5cf01beba594617c9dbfdf.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 July 2023 08:13 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/2 "2023-07-10T08:13:20Z")

</div>

Please post logs as text - so that they are more readable and searchable.

Dont forget to hit the `</>` code button before pasting (to ensure log text formatting is preserved in the post)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 July 2023 08:17 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/3 "2023-07-10T08:17:40Z")

</div>

PS: this is a nodejs thing and there are [lots of posts on the internet](https://www.google.com/search?q=node+pem+routines+no+start+line)

Some common causes are

- getting the files mixed up (i.e. key and cert swapped)
- not including the `-----BEGIN PUBLIC KEY-----` at the beginning and `-----END PUBLIC KEY-----` at the end.

---

<div class="post-metadata">

**Author:** ![TROJAN053](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TROJAN053](https://discourse.nodered.org/u/TROJAN053)\
**Post date:** [10 July 2023 08:29 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/4 "2023-07-10T08:29:34Z")

</div>

```auto
Microsoft Windows [Version 10.0.20348.1487]
(c) Microsoft Corporation. All rights reserved.

C:\Users\sks398596>node-red
Failed to get https settings: Error: error:0480006C:PEM routines::no start line
Error: error:0480006C:PEM routines::no start line
    at node:internal/tls/secure-context:69:13
    at Array.forEach (<anonymous>)
    at setCerts (node:internal/tls/secure-context:67:3)
    at configSecureContext (node:internal/tls/secure-context:156:5)
    at Object.createSecureContext (node:_tls_common:117:3)
    at Server.setSecureContext (node:_tls_wrap:1354:27)
    at Server (node:_tls_wrap:1218:8)
    at new Server (node:https:74:3)
    at Object.createServer (node:https:112:10)
    at C:\Users\sks398596\AppData\Roaming\npm\node_modules\node-red\red.js:228:24

```

---

<div class="post-metadata">

**Author:** ![TROJAN053](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TROJAN053](https://discourse.nodered.org/u/TROJAN053)\
**Post date:** [10 July 2023 08:32 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/5 "2023-07-10T08:32:33Z")

</div>

My Https setting is as follows in setting.js

```auto

    /** The following property can be used to enable HTTPS
     * This property can be either an object, containing both a (private) key
     * and a (public) certificate, or a function that returns such an object.
     * See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
     * for details of its contents.
     */

    /** Option 1: static object */
    https: {
      key: require("fs").readFileSync('C:/Users/sks398596/.node-red/certs/nred-key.crt'),
      cert: require("fs").readFileSync('C:/Users/sks398596/.node-red/certs/nred-cert.crt')
    },

    /** Option 2: function that returns the HTTP configuration object */
    // https: function() {
    // // This function should return the options object, or a Promise
    // // that resolves to the options object
    // return {
    // key: require("fs").readFileSync('privkey.pem'),
    // cert: require("fs").readFileSync('cert.pem')
    // }
    // },

    /** If the `https` setting is a function, the following setting can be used
     * to set how often, in hours, the function will be called. That can be used
     * to refresh any certificates.
     */
    //httpsRefreshInterval : 12,

    /** The following property can be used to cause insecure HTTP connections to
     * be redirected to HTTPS.
     */
    //requireHttps: true,

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 July 2023 09:02 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/6 "2023-07-10T09:02:22Z")

</div>

And?

Did you look inside the `privkey.pem` and `cert.pem` to check they had the correct content

Who ever gave them to might have mixed them up or removed the `-----BEGIN` and `-----END ` lines!

---

<div class="post-metadata">

**Author:** ![TROJAN053](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TROJAN053](https://discourse.nodered.org/u/TROJAN053)\
**Post date:** [11 July 2023 00:35 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/7 "2023-07-11T00:35:28Z")

</div>

Hi steve-Mcl,  
I am using the option 1 key:nred-key.crt and certificate: nred-cert.crt. I have used openssl method to generate the key and CSR. Based on CSR file generated my IT support team has given the SSL certificate.

---

<div class="post-metadata">

**Author:** ![TROJAN053](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TROJAN053](https://discourse.nodered.org/u/TROJAN053)\
**Post date:** [12 July 2023 03:13 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/8 "2023-07-12T03:13:23Z")

</div>

Hi, steve,  
I converted my SSL certificate from .crt to .pem and opened in notepad. ---Begin and ----Start line are available in the certificate.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 September 2023 03:13 UTC](https://discourse.nodered.org/t/failed-to-get-https-settings/79683/9 "2023-09-10T03:13:30Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
