ops: add public GET /api/health to logicsrc-web for status.profullstack.com (#233)
Some checks failed
CI / build (push) Has been cancelled
Deploy to dev2 / deploy (push) Has been cancelled
test / test (push) Has been cancelled

A filesystem route, so it wins over the CommandBoard /api/:path* rewrite
(unset in prod today, which left /api/health to the catch-all 404). One
head-only PostgREST query on blog_posts with a 3s cap: 200
{"status":"ok","db":"ok"} or 503 {"status":"error","db":"down"},
Cache-Control: no-store. The proxy skips the crawl gateway for the path.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-10-06 11:46:50 -07:00 • committed by GitHub
parent c4c05331e3
commit 356a850cb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import { NextResponse } from "next/server";
import { publicClient } from "@/lib/supabase";
// A cached answer reports the cache's health, not the app's.
export const dynamic = "force-dynamic";
const headers = { "Cache-Control": "no-store" };
// GET /api/health — public liveness + database check for status.profullstack.com.
// A filesystem route, so it wins over the CommandBoard `/api/:path*` rewrite.
// One head-only PostgREST query with a 3s cap; the failure reason is never returned.
export async function GET() {
try {
const { error } = await publicClient()
.from("blog_posts")
.select("slug", { head: true })
.limit(1)
.abortSignal(AbortSignal.timeout(3000));
if (error) throw error;
} catch {
return NextResponse.json({ status: "error", db: "down" }, { status: 503, headers });
}
return NextResponse.json({ status: "ok", db: "ok" }, { headers });
}