# NR Editor constently loses connections and Trying to setup NR https using the https key and cert for a docker image running in pivotal cloudFoundry backed by AWS to resolve

**URL:** <https://discourse.nodered.org/t/nr-editor-constently-loses-connections-and-trying-to-setup-nr-https-using-the-https-key-and-cert-for-a-docker-image-running-in-pivotal-cloudfoundry-backed-by-aws-to-resolve/60268>\
**Category:** General\
**Tags:** security\
**Created:** [24 March 2022 01:07 UTC](https://discourse.nodered.org/t/nr-editor-constently-loses-connections-and-trying-to-setup-nr-https-using-the-https-key-and-cert-for-a-docker-image-running-in-pivotal-cloudfoundry-backed-by-aws-to-resolve/60268 "2022-03-24T01:07:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimm1139](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jimm1139](https://discourse.nodered.org/u/jimm1139)\
**Post date:** [24 March 2022 01:07 UTC](https://discourse.nodered.org/t/nr-editor-constently-loses-connections-and-trying-to-setup-nr-https-using-the-https-key-and-cert-for-a-docker-image-running-in-pivotal-cloudfoundry-backed-by-aws-to-resolve/60268/1 "2022-03-24T01:07:58Z")

</div>

Pivotal uses instance Identity Credentials and they are surfaced with the environment variables I during run time I convert them using openssl as follows to get the RSA key and the Certificate only section as follows:  
openssl rsa -in $CF\_INSTANCE\_KEY \> key.pem for the key file  
openssl x509 -in $CF\_INSTANCE\_CERT -out cert.pem

I added them to the settings.js under the function for https as follows

```auto
    https: function() {
         // This function should return the options object, or a Promise
         // that resolves to the options object
         return {
             key: require("fs").readFileSync('key.pem'),
             cert: require("fs").readFileSync('cert.pem')
         }
     },

```

I deployed the changes and node red launches and runs but get 502 gateway errors when I try to hit the hostname.  
If I comment out the http config  
Node red launches in https without https configured in node red which then displays constent messages stating that node-red ost connection  
Many errors in the browser console not found

Trying to get this to function please help

---

<div class="post-metadata">

**Author:** ![jimm1139](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jimm1139](https://discourse.nodered.org/u/jimm1139)\
**Post date:** [24 March 2022 16:19 UTC](https://discourse.nodered.org/t/nr-editor-constently-loses-connections-and-trying-to-setup-nr-https-using-the-https-key-and-cert-for-a-docker-image-running-in-pivotal-cloudfoundry-backed-by-aws-to-resolve/60268/2 "2022-03-24T16:19:44Z")

</div>

Can someone provide guidance with this

---

<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:** [23 May 2022 16:20 UTC](https://discourse.nodered.org/t/nr-editor-constently-loses-connections-and-trying-to-setup-nr-https-using-the-https-key-and-cert-for-a-docker-image-running-in-pivotal-cloudfoundry-backed-by-aws-to-resolve/60268/3 "2022-05-23T16:20:00Z")

</div>

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