Koa Force SSL
A class for creating Koa middlewares that redirect requests to their HTTPS counterparts.
Note: Requests from a local IP address are not redirected. This is acheived by using the is-local-ip package.
Installation
Install the package with NPM:
npm install @donutteam/koa-force-ssl
Usage
To use this class, simply instantiate an instance and add it to your Koa stack:
import Koa from "koa";
import { ForceSSLMiddleware } from "@donutteam/koa-force-ssl";
const app = new Koa();
const forceSSLMiddleware = new ForceSSLMiddleware();
// Be sure to add the execute function on the instance
// and NOT the instance itself
app.use(forceSSLMiddleware.execute);