NodeJS connect to backend over 2 way SSL - certificates

Not applicable

Hi,

I am trying to use NodeJS to connect to the backend over https. Using the request module to connect

var options = { url: 'https:xxxx.com', method:'POST', cert: fs.readFileSync(__dirname + '/xxxx.cer', 'utf-8'), key: fs.readFileSync(__dirname + '/xxxx.key', 'utf-8'), agent: false, rejectUnauthorized: false, auth:{ 'password':'xxx.' } };

It works perfectly fine...My question is should I have the cer/pem files in a directory or is there a way to use the keystore...

We have different certificates for production and other environments. what is the best way to manage the certificates.

Thanks in advance

0 2 469
2 REPLIES 2

Apigee node.js does not allow a way to access the keystore, truststore on Edge.

To manage certs for different environments, you can use deploy time (CI/CD tools) to bundle the right certificate for a specific environment. So only the right certs are present in the bundle for an environment.

Hi,

Thanks for coming back..

where should we store the certificate files?

Thanks