It's a fork of auto-sni.
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.
- If creating a certificate fails it will fall back to a simple self signed certificate.
- 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 = ;// Override the https module in AutoSNI with restify.createServerhttps = restify;// Use a special restify option.var app = ;app;
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 $(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
Location of certificates
For production you may wish to start backing up or distributing the certificates across multiple sersers. Auto-SNI stores the certificates under the
~/letsencrypt folder. During development you may find you need to refresh/reset these cerificates, in which case you can simply remove the directory.
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!