tasko/middleware.ts

23 lines
489 B
TypeScript
Raw Normal View History

2024-03-21 21:15:27 +00:00
import { clerkMiddleware } from '@clerk/nextjs/server';
2024-12-27 23:24:19 +00:00
import arcjet, { shield, detectBot } from './lib/arcjet';
import { createMiddleware } from '@arcjet/next';
2024-03-21 21:15:27 +00:00
2024-12-27 23:24:19 +00:00
const aj = arcjet
.withRule(
shield({
mode: 'LIVE',
})
)
.withRule(
detectBot({
mode: 'LIVE',
allow: ['CATEGORY:SEARCH_ENGINE'],
})
);
2024-03-21 21:15:27 +00:00
export const config = {
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
};
export default createMiddleware(aj, clerkMiddleware());