32 lines
898 B
TypeScript
32 lines
898 B
TypeScript
import type { NextRequest } from 'next/server';
|
|
import { NextResponse } from 'next/server';
|
|
|
|
/**
|
|
* Minimal middleware that only sets x-pathname header
|
|
* All auth/role/demo logic has been removed
|
|
*/
|
|
export function middleware(request: NextRequest) {
|
|
const { pathname } = request.nextUrl;
|
|
|
|
const response = NextResponse.next();
|
|
response.headers.set('x-pathname', pathname);
|
|
|
|
return response;
|
|
}
|
|
|
|
/**
|
|
* Configure which routes the middleware should run on
|
|
*/
|
|
export const config = {
|
|
matcher: [
|
|
/*
|
|
* Match all request paths except:
|
|
* - _next/static (static files)
|
|
* - _next/image (image optimization files)
|
|
* - _next/data (Next.js data requests)
|
|
* - favicon.ico (favicon file)
|
|
* - Files with extensions (static assets)
|
|
*/
|
|
'/((?!_next/static|_next/image|_next/data|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|mp4|webm|mov|avi)$).*)',
|
|
],
|
|
}; |