Express middleware that will do a 301 redirect if the Elastic Load Balancer adds a x-forwarded-proto=http to the request headers
npm install @crystallize/elasticloadbalancer-express-force-httpsThis package makes it easy to force HTTPS using Express. Since HTTPS is faster than HTTP. The package is generic but was built for the Crystallize React Commerce boilerplate.
```
yarn add @crystallize/elasticloadbalancer-express-force-https
`
const express = require('express');
const forceHttps = require('@crystallize/elasticloadbalancer-express-force-https');
const server = express();
server.use(forceHttps());
`
Pass an optional options object if needed
Optional
Strip the leading www. from the host for both https and http requests
Optional
Redirect to a given hostname. Example from old-site.com to new-site.com:
```
redirectHostnames: {
'old-site.com': 'new-site.com'
}