koa-enforces-ssl
This simple module enforces HTTPS connections on any incoming requests. In case of a non-encrypted HTTP request, koa-enforces-ssl automatically redirects to an HTTPS address using a 301 permanent redirect.
koa-enforces-ssl also works behind reverse proxies (load balancers) as they are for example used by Heroku and nodejitsu. In such cases, however, the proxy
parameter has to be set to true
(see below).
Usage
npm install koa-enforces-ssl --save
const Koa = const ssl = const app = appproxy = true app app const port = processenvPORT || 3000 app
Prior art
This module was heavily inspired by Hengki Sihombing's express-enforces-ssl module.