SSL Certificates using SNI with almost zero configuration for free with https://letsencrypt.org!
If you have any questions, throw them up on gitter.
npm install auto-sni
- Fetch SSL certificates from letsencrypt.
- Automatically renew certificates.
- Forward all incoming http requests to https.
var createServer = ;var server =;// Server is a "https.createServer" instance.server;
Usage with express.
var createServer = ;var express = ;var app = ;app;;
Usage with koa.
var createServer = ;var koa = ;var app = ;app;;
Usage with rill.
var createServer = ;var rill = ;var app = ;app;;
Usage with hapi.
// Untested (Let me know in gitter if this doesn't work.)var createServer = ;var hapi = ;var server = ;var secureServer = ;server;
Usage with restify.
// Untested (Let me know in gitter if this doesn't work.)var createServer = ;var restify = ;var app = restify;app;;
You can also specify an async function to approve domains like so:
AutoSNI requires access to low level ports 80 (http) and 443 (https) to operate by default. These ports are typically restricted by the operating system.
In production (on linux servers) you can use the following command to give Node access to these ports.
sudo setcap cap_net_bind_service=+ep `readlink -f \`which node\``
For development it's best to set the "ports" option manually to something like:
ports:http: 3001https: 3002// Access server on localhost:3002
Currently LetsEncrypt imposes some rate limits on certificate creation. Click here for the current rate limits.
npm test for tests and feel free to create a PR!