Socket
Socket
Sign inDemoInstall

next-ssl-redirect-middleware

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    next-ssl-redirect-middleware

Nextjs Middleware to redirect http to https


Version published
Weekly downloads
880
increased by19.89%
Maintainers
1
Install size
15.3 kB
Created
Weekly downloads
 

Readme

Source

next-ssl-redirect-middleware

Nextjs Middleware to redirect http to https. This is helpful if you are hosting your site on a service that doesn't have "force ssl" support out of the box (IE: heroku).

Install

npm i -S next-ssl-redirect-middleware

Usage

Create a file middleware.ts (or .js) with the following:

import sslRedirect from 'next-ssl-redirect-middleware';

export default sslRedirect({});

Options:

  • environments: List of NODE_ENV to run this middleware for. Defaults ['production']

  • status: The status code to redirect with. defaults to 301

Credits

paulomcnally/node-heroku-ssl-redirect was referenced heavily in the creation of this library.

Keywords

FAQs

Last updated on 28 Aug 2023

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