import type { NextRequest } from "next/server"; import { NextResponse } from "next/server"; export function middleware(request: NextRequest) { // todo: make this redirect to the users profile if they have a profile selected if (request.nextUrl.pathname == "/") { return NextResponse.redirect(new URL("/search", request.url)); } const requestHeaders = new Headers(request.headers); requestHeaders.set("x-url", request.url); return NextResponse.next({ request: { // New request headers headers: requestHeaders, }, }); } export const config = { matcher: "/((?!api|_next/static|_next/image|favicon.ico).*)", };