@ryanburnette/express-force-canonical
v4.0.4
Published
Express.js middleware to force HTTPS and a canonical host.
Downloads
14
Maintainers
Readme
express-force-canonical
Express.js middleware to force HTTPS and a canonical host. It works behind a proxy, and on Heroku.
Usage
It may not work reliably unless it is the first Middleware added.
if (process.env.NODE_ENV === 'production') {
var forceCanonical = require('@ryanburnette/express-force-canonical');
app.use(
forceCanonical({
// host (required)
host: 'www.myawesomewebsite.com',
// redirect status code (optional, defaults to 308)
statusCode: 308
})
);
}