export async function middleware(request: NextRequest) {
const NEXT_ACTION = headers().get("next-action")
if (NEXT_ACTION === ContactActions.Mail) {
console.log("Is mail servera ction")
return NextResponse.json({
status: "error",
message: "You have reached the limit"
}, { status: 429 })
}
}
export const config = {
matcher: '/:path*',
}
I'm trying to do some kind of ratelimiting but I coudn't respond to server actions from middleware to access it in the form and getting undefined