1.0.3 • Published 6 years ago

express-force-https-schema v1.0.3

Weekly downloads
665
License
MIT
Repository
github
Last release
6 years ago

express-force-https-schema

Installation

$ npm install express-force-https-schema

Description

Very simple configurable express middleware that forces https schema based on x-forwarded-proto header.

The x-forwarded-proto is used by Heroku, AWS ELB and others to tell which schema the request was made with.

Usage

import forceHttpsSchema from "express-force-https-schema";

const app = express();

app.use(
  forceHttpsSchema({
    enabled: process.env.FORCE_HTTPS === "true",
    skipUserAgents: /ELB-HealthChecker/i
  })
);

Options

KeyDefault
enabledtrue
userAgentHeaderuser-agent
schemaHeaderx-forwarded-proto
skipUserAgentsnull

Test

npm test