Package Exports
- next-ssl-redirect-middleware
- next-ssl-redirect-middleware/dist/index.js
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 (next-ssl-redirect-middleware) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
nextjs-ssl-redirect-middlewear
Nextjs Middleware to redirect http to https. This is helpful if you are hosting your site on a service where this redirect doesn't happen automatically (IE heroku).
Install
npm i -S next-ssl-redirect-middleware
Usage
Create a file pages/_middleware.ts (or .js) with the following:
import sslRedirect from 'next-ssl-redirect-middleware';
export default sslRedirect({});Options:
environments: List ofNODE_ENVto run this middleware for. Defaults['production']status: The status code to redirect with. defaults to301
Notes:
paulomcnally/node-heroku-ssl-redirect was referenced in the creation of this library.