From 43890eeba68573489bd644efb77dc96592793cda Mon Sep 17 00:00:00 2001 From: lyc8503 Date: Fri, 11 Apr 2025 23:30:34 +0800 Subject: [PATCH] fix: pages colo --- pages/api/check.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/api/check.ts b/pages/api/check.ts index 09ba1a9..9b771a9 100644 --- a/pages/api/check.ts +++ b/pages/api/check.ts @@ -1,5 +1,6 @@ import { NextRequest } from "next/server" import { getStatus } from "@/worker/src/monitor" +import { getWorkerLocation } from "@/worker/src/util" import { MonitorTarget } from "@/uptime.types" export const runtime = 'edge' @@ -7,7 +8,7 @@ export const runtime = 'edge' // Check proxy if moved from Workers to Pages, https://github.com/lyc8503/UptimeFlare/issues/86#issuecomment-2655187257 export default async function handler(req: NextRequest): Promise { const target = await req.json() - const colo = req.headers.get("cf-ray")?.split("-")[1] + const colo = await getWorkerLocation() console.log("Check proxy running at " + colo + ", Target: " + target) return new Response( JSON.stringify({