diff --git a/example/src/pages/ip/_middleware.ts b/example/src/pages/ip/_middleware.ts index 9fd108a..e85a4a6 100644 --- a/example/src/pages/ip/_middleware.ts +++ b/example/src/pages/ip/_middleware.ts @@ -6,7 +6,9 @@ export const middleware: NextMiddleware = (req, event) => { const ips = req.cookies['__allowed_ips'] if (!ips) { if (req.preflight) return new NextResponse(null) - return NextResponse.redirect('/ip') + const url = req.nextUrl.clone() + url.pathname = '/ip' + return NextResponse.redirect(url) } return makeIPInspector(ips.split(','), {