Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active December 15, 2020 11:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save nanusdad/cac5e46b415794e9de83b3058c917354 to your computer and use it in GitHub Desktop.
Save nanusdad/cac5e46b415794e9de83b3058c917354 to your computer and use it in GitHub Desktop.
Express JS with GoDaddy SSL Certificates

How to use GoDaddy SSL certs with Express JS

  • Node requires each certificate in the CA chain to be passed separately in an array.
  • GoDaddy provides a cerficate file (gd_bundle.crt) probably looks like this:
-----BEGIN CERTIFICATE-----
MIIE3jCCA...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEADCCA...
-----END CERTIFICATE-----
  • Each certificate needs to be put in its own file (ie gd1.crt and gd2.crt) and read separately.
https.createServer({
    key: fs.readFileSync('domain.key'),
    cert: fs.readFileSync('domain.crt'),
    ca: [fs.readFileSync('gd1.crt'), fs.readFileSync('gd2.crt'), fs.readFileSync('gd3.crt')]
}, app).listen(app.locals.port, function() {
   console.log("Started on PORT " + app.locals.port);
});

Links

@kadru
Copy link

kadru commented Jul 6, 2018

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment