Rewrite URLs to https.
npm install --save https-rewrite
Currently only express@^4.0.0
is supported as the engine to perform rewrites in.
const redirectToHttps = require('https-rewrite/express');
// ... set up express
// Should be one of the topmost (if not the) middlewares.
app.use(redirectToHttps({
// Change the status code used to redirect. Defaults to 307.
status: 301
}))
MIT © jutaz