MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / middleware

Function middleware

app/src/middleware/httpsRedirect.ts:4–11  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

2import type { NextRequest } from "next/server";
3
4export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected