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.
955 B ยท 35 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536import type { Action, ComposeInput } from "./types";
type Input = Pick< ComposeInput, "route" | "host" | "pathname" | "search" | "requestUrl">;
/** * Fallback rewrite: target is the route's internal `rewritePath`. Fires when * either: * - the request is on an openstatus.dev host (preserved from original โ * unclear if this no-op rewrite is load-bearing when rewritePath === * pathname; kept as-is), OR * - the resolved rewritePath differs from the incoming pathname. */export function resolveDefaultRewrite({ route, host, pathname, search, requestUrl,}: Input): Action | null { const isOpenstatusDevHost = !!host?.includes("openstatus.dev"); const pathDiffers = route.rewritePath !== pathname;
if (!isOpenstatusDevHost && !pathDiffers) return null;
const url = new URL(route.rewritePath, requestUrl); url.search = search; return { type: "rewrite", url, reason: "default-rewrite", };}