how to exclude particular dynamic route from middleware config matcher
Unanswered
Silver Fox posted this in #help-forum
Silver FoxOP
i have a auth middleware with the config setup like this
export const config = {
matcher: [
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public).)", // does not run authentication middleware on thes routes
"/api/auth/login",
"/api/auth/logout",
],
};
i want middleware should not run on dynamic route [projectId]/chat only but should run on other [projectId] routes
i tried
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public|:projectId/chat).)"
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public|[projectId]/chat).*)"
but they are not working
export const config = {
matcher: [
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public).)", // does not run authentication middleware on thes routes
"/api/auth/login",
"/api/auth/logout",
],
};
i want middleware should not run on dynamic route [projectId]/chat only but should run on other [projectId] routes
i tried
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public|:projectId/chat).)"
"/((?!$|api|_next/static|_next/image|favicon.ico|auth|public|[projectId]/chat).*)"
but they are not working