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
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
705 B ยท 22 lines
TypeScript
1234567891011121314151617181920212223// List of all Cloudflare data center taken by https://www.feitsui.com/en/article/26import { regions } from "../regions/cloudflare";import type { ParserReturn, Region } from "../types";
export function parseCfRay(header: string): ParserReturn<Region> { const regex = /\b([A-Z]{3})\b/g; const arr = header.match(regex);
if (!arr || !Array.isArray(arr) || arr.length === 0) { return { status: "failed", error: new Error("Couldn't parse the header.") }; }
const region = regions[arr[0]]; if (region) return { status: "success", data: region };
return { status: "failed", error: new Error( `It seems like the data center '${arr[0]}' (iata) is not listed.`, ), };}