Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-ssl-redirect-middleware

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-ssl-redirect-middleware - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

1

dist/index.js

@@ -6,3 +6,2 @@ "use strict";

const currentEnv = process.env.NODE_ENV;
console.log('running middleware!');
if (environments.includes(currentEnv) && req.headers.get("x-forwarded-proto") !== "https") {

@@ -9,0 +8,0 @@ return server_1.NextResponse.redirect(`https://${req.nextUrl.hostname}${req.nextUrl.pathname}`, status);

2

package.json
{
"name": "next-ssl-redirect-middleware",
"version": "0.0.4",
"version": "0.1.0",
"description": "Nextjs Middleware to redirect http to https",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -16,7 +16,13 @@ # nextjs-ssl-redirect-middlewear

export const middleware = sslRedirect();
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 `302`
## Notes:
[paulomcnally/node-heroku-ssl-redirect](https://github.com/paulomcnally/node-heroku-ssl-redirect) was referenced in the creation of this library.

@@ -15,3 +15,2 @@ import { NextFetchEvent, NextRequest, NextResponse } from 'next/server'

const currentEnv = process.env.NODE_ENV as Environment;
console.log('running middleware!');

@@ -18,0 +17,0 @@ if (environments.includes(currentEnv) && req.headers.get("x-forwarded-proto") !== "https") {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc