www/app/middleware.ts
Xe Iaso ffd029cdbb incorporate arcjet
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-09-09 23:02:59 -04:00

17 lines
669 B
TypeScript

import arcjet, { createMiddleware, shield } from "@arcjet/next";
export const config = {
// matcher tells Next.js which routes to run the middleware on.
// This runs the middleware on all routes except for static assets.
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};
const aj = arcjet({
key: process.env.ARCJET_KEY!, // Get your site key from https://app.arcjet.com
rules: [
// Protect against common attacks with Arcjet Shield
shield({
mode: "LIVE", // will block requests. Use "DRY_RUN" to log only
}),
],
});
// Pass any existing middleware with the optional existingMiddleware prop
export default createMiddleware(aj);