fix: pages colo
parent
0f2e9313c1
commit
43890eeba6
|
|
@ -1,5 +1,6 @@
|
||||||
import { NextRequest } from "next/server"
|
import { NextRequest } from "next/server"
|
||||||
import { getStatus } from "@/worker/src/monitor"
|
import { getStatus } from "@/worker/src/monitor"
|
||||||
|
import { getWorkerLocation } from "@/worker/src/util"
|
||||||
import { MonitorTarget } from "@/uptime.types"
|
import { MonitorTarget } from "@/uptime.types"
|
||||||
|
|
||||||
export const runtime = 'edge'
|
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
|
// 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<Response> {
|
export default async function handler(req: NextRequest): Promise<Response> {
|
||||||
const target = await req.json<MonitorTarget>()
|
const target = await req.json<MonitorTarget>()
|
||||||
const colo = req.headers.get("cf-ray")?.split("-")[1]
|
const colo = await getWorkerLocation()
|
||||||
console.log("Check proxy running at " + colo + ", Target: " + target)
|
console.log("Check proxy running at " + colo + ", Target: " + target)
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue