Socket
Socket
Sign inDemoInstall

heroku-ssl-redirect

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    heroku-ssl-redirect

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


Version published
Weekly downloads
8.8K
increased by4.67%
Maintainers
1
Install size
5.37 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 09 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc