42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
// export { auth as middleware } from './auth'
|
|
|
|
// export const config = {
|
|
// matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)']
|
|
// }
|
|
|
|
import { i18nRouter } from 'next-i18n-router';
|
|
import i18nConfig from './i18nConfig';
|
|
import { NextResponse, NextRequest, NextFetchEvent } from 'next/server'
|
|
|
|
// This function can be marked `async` if using `await` inside
|
|
export function middleware(req: NextRequest, evt: NextFetchEvent) {
|
|
// return NextResponse.redirect(new URL('/home', request.url))
|
|
|
|
console.log(`
|
|
======>
|
|
${req.url} - ${JSON.stringify(req)} - ${req.nextUrl.pathname}
|
|
`)
|
|
|
|
return i18nRouter(req, i18nConfig);
|
|
}
|
|
|
|
|
|
|
|
// export const config = {
|
|
// matcher: [
|
|
// "/app",
|
|
// "/app/(.*)",
|
|
// "/auth/(.*)",
|
|
// "/(api|trpc)(.*)",
|
|
// "/((?!_next/static|_next/image|images|favicon.ico|$).*)",
|
|
// ],
|
|
// };
|
|
|
|
// only applies this middleware to files in the app directory
|
|
export const config = {
|
|
matcher: '/((?!api|static|.*\\..*|_next).*)'
|
|
};
|
|
|
|
// export const config = {
|
|
// matcher: ['/((?!api|_next/static|_next/image|favicon.ico|favicon.png).*)']
|
|
// }
|