© 2026 Hedgehog Software, LLC
import { NextResponse, type NextRequest } from 'next/server'; export { default } from 'next-auth/middleware'; export const config = { matcher: [ /* * Match all request paths except for the ones starting with: * - api (API routes) * - _next/static (static files) * - _next/image (image optimization files) * - favicon.ico (favicon file) * - login (login route) * - img (static images from the public folder) */ '/((?!api|_next/static|_next/image|favicon.ico|login|img|logout).*)', ], }; export function middleware(request: NextRequest) { if (request.nextUrl.pathname === '/') { return NextResponse.redirect(new URL('/products', request.url)); } return NextResponse.next(); }
http://localhost:3000/login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fproducts