disable arcjet on healthchecks

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2024-10-03 09:09:40 -04:00
parent d6710bccd1
commit 9b0f7f6e33
No known key found for this signature in database
3 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ spec:
service: techaro-lol service: techaro-lol
port: 80 port: 80
replicas: replicas:
min: 0 min: 1
max: 10 max: 10
scaledownPeriod: 300 scaledownPeriod: 300
scalingMetric: scalingMetric:

View File

@ -44,10 +44,12 @@ spec:
type: RuntimeDefault type: RuntimeDefault
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /_healthz
port: 3000 port: 3000
httpHeaders: httpHeaders:
- name: X-Real-Ip - name: x-real-ip
value: "127.0.0.1" value: "100.100.100.100"
- name: user-agent
value: "Kubernetes healthchecks"
initialDelaySeconds: 3 initialDelaySeconds: 3
periodSeconds: 3 periodSeconds: 3

View File

@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from "next/server";
export const config = { export const config = {
// matcher tells Next.js which routes to run the middleware on. // matcher tells Next.js which routes to run the middleware on.
// This runs the middleware on all routes except for static assets. // This runs the middleware on all routes except for static assets.
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"], matcher: ["/((?!_next/static|_next/image|favicon.ico|/_healthz).*)"],
}; };
const aj = arcjet({ const aj = arcjet({
@ -30,6 +30,7 @@ export default async function middleware(request: NextRequest) {
console.log(req.ip); console.log(req.ip);
const decision = await aj.protect(req); const decision = await aj.protect(req);
console.log(decision);
if ( if (
// If this deny comes from a bot rule then block the request. You can // If this deny comes from a bot rule then block the request. You can