Add Bot Protection Using Arcjet

This commit is contained in:
Ahmad 2024-12-27 18:24:19 -05:00
parent 611adcddff
commit a35fdff29f
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF

View file

@ -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)(.*)'],