# NodeRED not finding certificates

**URL:** https://discourse.nodered.org/t/nodered-not-finding-certificates/78349
**Category:** General
**Tags:** docker
**Created:** [11 May 2023 08:34 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349 "2023-05-11T08:34:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Justricity](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justricity/32/79758_2.png) [@Justricity](https://discourse.nodered.org/u/Justricity)
#### Post date: [11 May 2023 08:34 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349/1 "2023-05-11T08:34:21Z")

</div>

Hey everyone reading this.  
I am currently trying to crate a subdomain for my NodeRED Webinterface.  
Since I am using cloudflare i wanted/ need to secure my Webinterface through HTTPS  
Therefore i commented out the first Option in the settings.js and pasted the crtificate.pem and privatekey.pem in /mynodered/\_data/ (i am running NodeRED in Docker) but every time i try to run the container i get the following error:

```auto
Error loading settings file: /data/settings.js
Error: ENOENT: no such file or directory, open 'privatekey.pem'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at Object.<anonymous> (/data/settings.js:94:26)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:140:20) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'privatekey.pem'

```

from this i am reading that it can't find the private key but it is in the same directory as the settings. Can anybody help me out finding a way to solve this error and secure the Webinterface over HTTPS?  
Best Regards Justricity

---

<div class="post-metadata">

### Author: ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)
#### Post date: [11 May 2023 08:54 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349/2 "2023-05-11T08:54:09Z")

</div>

You should add the full path in the `settings.js` file.  
Like this:

```auto
/** Option 1: static object */
    https: {
      key: require("fs").readFileSync('/data/node-key.pem'),
      cert: require("fs").readFileSync('/data/node-cert.pem')
    },

```

Tested in docker without path I got exactly your error, with path it works.

---

<div class="post-metadata">

### Author: ![Justricity](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justricity/32/79758_2.png) [@Justricity](https://discourse.nodered.org/u/Justricity)
#### Post date: [11 May 2023 10:05 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349/3 "2023-05-11T10:05:46Z")

</div>

thanks it works now or at least its not crashing anymore and stays up running. But still coudflare presents me a page that the webserver is down even though it's up but ig for that topic here is not the right place for it.  
Although if anyone is interested i have my domain proxied through cloudflare and my subdomain [node.domain.de](http://node.domain.de) points to my proxy wich proxys it through to my main server on port 1880. Since my SSL/TLS settings are set to full and have a certificate for nodered but it still shows me a HTTP ERROR:521

---

<div class="post-metadata">

### Author: ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)
#### Post date: [11 May 2023 12:10 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349/4 "2023-05-11T12:10:50Z")

</div>

> [@Justricity](#):
>
> thanks it works now

Easy fix 🙂

Error 521... is your certificate signed by a publicly trusted authority?

---

<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 July 2023 12:10 UTC](https://discourse.nodered.org/t/nodered-not-finding-certificates/78349/5 "2023-07-10T12:10:59Z")

</div>

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