Installing a real SSL certificate
In order to move a secure application out of a development environment and into an internet-exposed environment, a real certificate will need to be purchased. The prices of these certificates has been dropping year by year, and it should be easy to find reasonably priced providers of certificates with a high-enough level of security. Some providers even offer free person-use certificates.
Setting up a professional cert simply requires changing the HTTPS options we introduced previously. Different providers will have different processes and filenames. Typically, you will need to download or otherwise receive from your provider a private .key file, your signed domain certificate .crt file, and a bundle describing certificate chains:
let options = {
key: fs.readFileSync("mysite.key"),
cert: fs.readFileSync("mysite.com.crt"),
ca: [ fs.readFileSync("gd_bundle.crt") ]
};
It is important to note that the ca parameter must be sent as an array, even if the bundle of certificates has been concatenated into one file.