next-ssl-redirect-middleware
Advanced tools
Comparing version 0.0.4 to 0.1.0
@@ -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); |
{ | ||
"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") { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15169
28
128