diff --git a/middleware.ts b/middleware.ts index 7220be9..754ab95 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,12 +1,19 @@ import { clerkMiddleware } from '@clerk/nextjs/server'; -import arcjet, { shield } from './lib/arcjet'; +import arcjet, { shield, detectBot } from './lib/arcjet'; import { createMiddleware } from '@arcjet/next'; -const aj = arcjet.withRule( - shield({ - mode: 'LIVE', - }) -); +const aj = arcjet + .withRule( + shield({ + mode: 'LIVE', + }) + ) + .withRule( + detectBot({ + mode: 'LIVE', + allow: ['CATEGORY:SEARCH_ENGINE'], + }) + ); export const config = { matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],