next-ssl-redirect-middleware
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -7,3 +7,4 @@ "use strict"; | ||
if (environments.includes(currentEnv) && req.headers.get("x-forwarded-proto") !== "https") { | ||
return server_1.NextResponse.redirect(`https://${req.nextUrl.hostname}${req.nextUrl.pathname}`, status); | ||
const hostname = req.headers.get('host') || req.nextUrl.hostname; | ||
return server_1.NextResponse.redirect(`https://${hostname}${req.nextUrl.pathname}`, status); | ||
} | ||
@@ -10,0 +11,0 @@ return server_1.NextResponse.next(); |
{ | ||
"name": "next-ssl-redirect-middleware", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Nextjs Middleware to redirect http to https", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,3 +17,4 @@ import { NextFetchEvent, NextRequest, NextResponse } from 'next/server' | ||
if (environments.includes(currentEnv) && req.headers.get("x-forwarded-proto") !== "https") { | ||
return NextResponse.redirect(`https://${req.nextUrl.hostname}${req.nextUrl.pathname}`, status); | ||
const hostname = req.headers.get('host') || req.nextUrl.hostname; | ||
return NextResponse.redirect(`https://${hostname}${req.nextUrl.pathname}`, status); | ||
} | ||
@@ -23,2 +24,2 @@ return NextResponse.next(); | ||
export default middleware; | ||
export default middleware; |
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
15899
9
139