Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am running an instance of ExpressJS using NodeJS and wish to have it start using HTTPS.

My company purchases SSL certificates through Network Solutions. When trying to give them my CSR, Network Solutions asks for the type of web server I am using. (i.e. IIS, Apache w/ModSSL, Plesk, etc.) It doesn't offer any option for NodeJS or other.

I have contacted their support with my question but while I wait I would like to know from the community.

  1. Which server type should I use? and

  2. Does it even matter?

If relevant, I generated the CSR with OpenSSL on Ubuntu.

share|improve this question

1 Answer 1

Node.js can handle certificates in multiple formats, but the most common and easiest to set up is the PEM format used by Apache, nginx, etc. It doesn't matter much what you request from NetSol, as long as it is not IIS, which uses a completely different format.

The only real hangup you may run into is with the intermediate CA certificates, which NetSol has a bunch of for some reason. These need to be concatenated together before use.

I would recommend you choose NetSol's Apache/Plesk option. With this option you'll receive several files, only two of which are important here:

  • example.com.crt - This is your actual certificate.
  • Apache_Plesk_Install.txt - Despite its confusing name, this file actually contains all of the intermediate CA certificates concatenated together, and you can use it as-is.

Of course, you will also need the private key you generated on your Ubuntu machine.

Even if you selected a different format for your keys, you should be able to log in to your account with Network Solutions and download your certificate and Apache_Plesk_Install.txt file separately.


Finally, you install these certificates somewhere on your server, and set up Node.js appropriately:

var https = require('https');
var fs = require('fs');

var options = {
  key: fs.readFileSync('.../keys/private.key'),
  cert: fs.readFileSync('.../keys/example.com.crt'),
  ca: fs.readFileSync('.../keys/Apache_Plesk_Install.txt')
};

https.createServer(options, function (req, res) {
  res.writeHead(200);
  res.end("hello world\n");
}).listen(443);

And you're done!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.