Skip to content

Instantly share code, notes, and snippets.

@JacobWay
Last active March 13, 2017 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JacobWay/0c64b730177d2a0c89b47af19f1496ff to your computer and use it in GitHub Desktop.
Save JacobWay/0c64b730177d2a0c89b47af19f1496ff to your computer and use it in GitHub Desktop.
Express.js over HTTPS

Express.js over HTTPS

Express.js over HTTPS

Generate self signed certificate

  • openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
  • openssl rsa -in key.pem -out newkey.pem && mv newkey.pem key.pem

Or using the commands below: from this link:

  • Create the private key: openssl genrsa -out key.pem 1024
  • Create the "Certificate Signing Request": openssl req -new -key key.pem -out csr.pem
  • Create the self-signed certificate: openssl x509 -req -in csr.pem -signkey key.pem -out cert.pem

Use Express with https

const https = require("https");

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