blob: f83dd6bd96d58c9ad23fc847075efa80acd9788c [file]
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function middleware(req: NextRequest) {
const url = req.nextUrl.clone();
if (url.pathname.startsWith("/api/v1")) {
const host = process.env.KVCTL_API_HOST || "localhost:9379";
url.host = host;
return NextResponse.rewrite(url);
}
return NextResponse.next();
}
export const config = {
matcher: "/api/v1/:path*",
runtime: "nodejs",
};