Files
pi-agent-integrated/pi-web/proxy.ts
T

12 lines
380 B
TypeScript

import { NextResponse, type NextRequest } from "next/server";
import { isApiRequestAllowed } from "@/lib/request-security";
export function proxy(request: NextRequest) {
if (!isApiRequestAllowed(request)) {
return NextResponse.json({ error: "Untrusted API request" }, { status: 403 });
}
return NextResponse.next();
}
export const config = { matcher: "/api/:path*" };