// PEP-337: the server's proxy asks «is this name ours?» before it gets a certificate for a product's // address (Caddy on-demand TLS, `ask`). No sign-in: the proxy calls it from the server itself; the // answer says only whether a name is a known stand. import { edgeHostKnown } from "@peppa/core"; import { db } from "@/lib/db"; export const dynamic = "force-dynamic"; export async function GET(req: Request) { const host = new URL(req.url).searchParams.get("domain") ?? ""; const ok = host.length > 0 && host.length <= 253 && (await edgeHostKnown(db, host).catch(() => false)); return new Response(ok ? "ok" : "unknown", { status: ok ? 200 : 404, headers: { "cache-control": "no-store", "content-type": "text/plain" } }); }