feat: Added more debug logging

This commit is contained in:
2026-08-25 13:26:23 +00:00
parent e5947489e4
commit 3e4ccc9720
4 changed files with 42 additions and 10 deletions
+10 -2
View File
@@ -32,17 +32,25 @@ async function fetchSnapshot(host: string, forwardedFor: string, pageId: string)
// intact.
if (forwardedFor) outbound["X-Forwarded-For"] = forwardedFor;
const url = `${base}/public/status/${encodeURIComponent(pageId)}`;
// This call is container-to-container and never appears in the front
// proxy's access log, which is why a 404 here reads as "Next 404'd it".
// Log both halves so the upstream status is visible in the web logs.
console.log(`[status] GET ${url} host=${host} xff=${forwardedFor || "-"}`);
let res: Response;
try {
res = await fetch(`${base}/public/status/${encodeURIComponent(pageId)}`, {
res = await fetch(url, {
headers: outbound,
cache: "no-store",
});
} catch {
} catch (e) {
// The control plane is unreachable. That is not "no such page".
console.error(`[status] upstream unreachable ${url}:`, e);
return { kind: "unavailable" };
}
console.log(`[status] upstream ${res.status} for ${url}`);
if (res.status === 404) return { kind: "not-found" };
// A 429, a 500 or anything else is a page that exists and cannot be read
// right now. Telling a customer mid-outage that their status page does not
File diff suppressed because one or more lines are too long