tasko/middleware.ts
2024-12-27 18:41:00 -05:00

28 lines
619 B
TypeScript

import { clerkMiddleware } from '@clerk/nextjs/server';
import arcjet, { shield, detectBot } from './lib/arcjet';
import { createMiddleware } from '@arcjet/next';
const aj = arcjet
.withRule(
shield({
mode: 'LIVE',
})
)
.withRule(
detectBot({
mode: 'LIVE',
allow: [
'CATEGORY:SEARCH_ENGINE',
'CATEGORY:VERCEL',
'CATEGORY:MONITOR',
'CATEGORY:PREVIEW',
'CATEGORY:OPTIMIZER',
],
})
);
export const config = {
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
};
export default createMiddleware(aj, clerkMiddleware());