sumisura
sumisura
TTCTheo's Typesafe Cult
Created by DYELbrah on 4/14/2024 in #questions
How to exclude specific routes from Clerk middleware?
Since you are using the older, deprecated authMiddleware, you have two options: 1. Use ignoredRoutes to explicitly exclude that route. 2. Change the regex for matcher to not match /api/cron You can find more info here: https://clerk.com/docs/references/nextjs/auth-middleware I suggest you ignore /api/cron. Just know that this path will not be protected by Clerk. You'll have to handle authentication yourself.
ignoredRoutes? string[]

A list of routes that should be ignored by the middleware. This list typically includes routes for static files or Next.js internals. For improved performance, these routes should be skipped using the default config.matcher instead.
ignoredRoutes? string[]

A list of routes that should be ignored by the middleware. This list typically includes routes for static files or Next.js internals. For improved performance, these routes should be skipped using the default config.matcher instead.
3 replies