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,11 +1,18 @@
import { clerkMiddleware } from '@clerk/nextjs/server'; import { clerkMiddleware } from '@clerk/nextjs/server';
import arcjet, { shield } from './lib/arcjet'; import arcjet, { shield, detectBot } from './lib/arcjet';
import { createMiddleware } from '@arcjet/next'; import { createMiddleware } from '@arcjet/next';
const aj = arcjet.withRule( const aj = arcjet
.withRule(
shield({ shield({
mode: 'LIVE', mode: 'LIVE',
}) })
)
.withRule(
detectBot({
mode: 'LIVE',
allow: ['CATEGORY:SEARCH_ENGINE'],
})
); );
export const config = { export const config = {