update
This commit is contained in:
27
middleware.ts
Normal file
27
middleware.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
// Allow email and projects API routes without authentication
|
||||
if (request.nextUrl.pathname.startsWith('/api/email/') ||
|
||||
request.nextUrl.pathname.startsWith('/api/projects/')) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// For all other routes, continue with normal processing
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
/*
|
||||
* Match all request paths except for the ones starting with:
|
||||
* - api/email (email API routes)
|
||||
* - api/projects (projects API routes)
|
||||
* - _next/static (static files)
|
||||
* - _next/image (image optimization files)
|
||||
* - favicon.ico (favicon file)
|
||||
*/
|
||||
'/((?!api/email|api/projects|_next/static|_next/image|favicon.ico).*)',
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user