JSPM

heroku-ssl-redirect

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9027
  • Score
    100M100P100Q138226F
  • License MIT

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

Package Exports

  • heroku-ssl-redirect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (heroku-ssl-redirect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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));