Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. 🫖 Status page with uptime monitoring & API monitoring as code 🫖 openstatus.dev
Something went wrong. Try again.
12345678910111213141516/** * Client IP for access-gate checks. Prefer `x-real-ip`: Vercel's edge sets it to * the single verified client IP, with no comma-chain to parse. `x-forwarded-for`'s * leftmost entry is the classic spoof vector on paths that reach a route directly * — `/api/*` bypasses the proxy middleware — so only fall back to it when * `x-real-ip` is absent (e.g. local dev). A null result denies ip-restricted pages. */export function resolveClientIp(headers: { get(name: string): string | null;}): string | null { const real = headers.get("x-real-ip"); if (real) return real.trim(); const xff = headers.get("x-forwarded-for"); return xff?.split(",")[0]?.trim() ?? null;}