heroku-ssl-redirect
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

node-heroku-ssl-redirect

Redirect users to the SSL version of your app. For ExpressJS running on Heroku.

This module works only with import, don't try to use require.

Installation

yarn add heroku-ssl-redirect

Usage

import sslRedirect from 'heroku-ssl-redirect';
import express from 'express';
const app = express();
 
// enable ssl redirect
app.use(sslRedirect());
 
app.get('/', (req, res) => {
  res.send('hello world');
});
 
app.listen(process.env.PORT || 3000);

Environments

Default environment is production, if you need enable redirect with other environment you need send an array argument.

app.use(sslRedirect([
  'other'
  'development',
  'production'
  ]));

HTTP status code

By default a 302 will be used to redirect. A 301 can be configured with the second argument.

app.use(sslRedirect(['production'], 301));

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    5,807
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    5,807
  • 0.1.0
    1
  • 0.0.4
    2,882
  • 0.0.3
    77
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i heroku-ssl-redirect

Weekly Downloads

8,769

Version

0.1.1

License

MIT

Unpacked Size

4.59 kB

Total Files

6

Last publish

Collaborators

  • paulomcnally