# Setting Node Red SSL on Docker

**URL:** https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491
**Category:** General
**Created:** [5 December 2018 03:46 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491 "2018-12-05T03:46:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![luisgcu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/luisgcu/32/4549_2.png) [@luisgcu](https://discourse.nodered.org/u/luisgcu)
#### Post date: [5 December 2018 03:46 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/1 "2018-12-05T03:46:15Z")

</div>

Hi guys, I am trying to set https secure connection with node red , I have generated the certificates following this tutorial [NODE\_RED SSL](http://www.steves-internet-guide.com/securing-node-red-ssl/), on settings.js uncomented the follwing:

```auto
var fs = require("fs");
https: {
        //key: fs.readFileSync('privatekey.pem'),
        //cert: fs.readFileSync('certificate.pem')
		key: fs.readFileSync('/data/node-cert.pem'),
        cert: fs.readFileSync('/data/node-key.pem')
    },
    // The following property can be used to cause insecure HTTP connections to
    // be redirected to HTTPS.
requireHttps: true,

```

But node-red wont start , the log show the following error, Any hint?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a47442d8b60f2c2bee3556b32dc9fd61a99b45ba.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 December 2018 10:01 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/2 "2018-12-05T10:01:48Z")

</div>

I think that may mean that your certificate file is not valid

---

<div class="post-metadata">

### Author: ![luisgcu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/luisgcu/32/4549_2.png) [@luisgcu](https://discourse.nodered.org/u/luisgcu)
#### Post date: [6 December 2018 01:55 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/3 "2018-12-06T01:55:04Z")

</div>

Thanks @colin , If my node-red is running in docker container , what would be the **common name** field when generating the certificate? the IP of my synology or the IP of the docker container?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [7 December 2018 12:38 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/4 "2018-12-07T12:38:53Z")

</div>

> [@luisgcu](#):
>
> If my node-red is running in docker container , what would be the **common name** field when generating the certificate?

Sorry, I don't know.

---

<div class="post-metadata">

### Author: ![jrg](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jrg/32/4205_2.png) [@jrg](https://discourse.nodered.org/u/jrg)
#### Post date: [21 December 2018 20:40 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/5 "2018-12-21T20:40:48Z")

</div>

I think it’s the format of your files, not the Common name you’ve chosen for the certificate, that could be the problem.

That “No start line” error looks like something from an underlying SSL library.

1. Are the line endings in the file correct for the system you’re running Node RED on (eg Unix doesn’t like Windows’ ^M - carriage return - characters),
2. Are the key and certificate definitely in a PEM format?

---

<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: [22 December 2018 01:24 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/6 "2018-12-22T01:24:53Z")

</div>

I had node-red fail to start due to assuming the path I entered in settings was relative to where I placed certs.

Try removing the path (use just the file names) and put a copy of certs in .node-red folder or possibly the node-red global folder.

Might be a different issue but I seen what you're seeing when the certs were not found. Worth a try?

---

<div class="post-metadata">

### Author: ![gschellhas](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@gschellhas](https://discourse.nodered.org/u/gschellhas)
#### Post date: [2 February 2019 21:06 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/7 "2019-02-02T21:06:46Z")

</div>

Your cert and priv key are backwards.

---

<div class="post-metadata">

### Author: ![luisgcu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/luisgcu/32/4549_2.png) [@luisgcu](https://discourse.nodered.org/u/luisgcu)
#### Post date: [2 February 2019 22:41 UTC](https://discourse.nodered.org/t/setting-node-red-ssl-on-docker/5491/8 "2019-02-02T22:41:10Z")

</div>

thanks all for the responses, I will try once again.. @gschellhas is right !! my cert and private key are backwards!!
