Skip to content

Instantly share code, notes, and snippets.

@alexmccabe
Last active February 7, 2017 11:49
Show Gist options
  • Save alexmccabe/68f41151a43cf64b637d744ddf689519 to your computer and use it in GitHub Desktop.
Save alexmccabe/68f41151a43cf64b637d744ddf689519 to your computer and use it in GitHub Desktop.
How to get SSL Chain Certificates in NodeJS. This took me a very long time to figure out.
// How to get SSL Chain certificate in NodeJS
/**
* You will receive multiple files from the SSL Certificate provider, one is
* the certificate, one is the bundle. Node requires this to be in a single
* .cert file.
*
* To do this from the terminal, concatonate the files together.
* cat website.com.crt bundle_name.crt > output-bundle.crt
*/
var httpsKeys = {
key: fs.readFileSync(path.normalize(__dirname + '/../config/ssl/node.kerve.com.key'), 'utf-8'),
cert: fs.readFileSync(path.normalize(__dirname + '/../config/ssl/bundle.crt'), 'utf-8'),
requestCert: true,
rejectUnauthorized: false
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment