(req: NextRequest)
| 2 | import type { NextRequest } from "next/server"; |
| 3 | |
| 4 | export function middleware(req: NextRequest) { |
| 5 | const hostname = req.headers.get("host") || req.nextUrl.hostname; |
| 6 | |
| 7 | if (!req.headers.get("x-forwarded-proto")?.includes("https") && !hostname.includes("localhost")) { |
| 8 | const url = new URL(req.nextUrl.pathname, `https://${hostname}`); |
| 9 | return NextResponse.redirect(url, 301); |
| 10 | } |
| 11 | } |
nothing calls this directly
no outgoing calls
no test coverage detected