Skip to content

Commit 435f7ab

Browse files
committed
Simplify healthcheck
1 parent 27a374e commit 435f7ab

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

app/routes/healthcheck.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
// learn more: https://fly.io/docs/reference/configuration/#services-http_checks
2-
import type { LoaderFunction } from "react-router";
3-
4-
export const loader: LoaderFunction = async ({ request }) => {
5-
const host =
6-
request.headers.get("X-Forwarded-Host") ?? request.headers.get("host");
7-
8-
try {
9-
const url = new URL("/", `http://${host}`);
10-
await Promise.all([
11-
fetch(url.toString(), { method: "HEAD" }).then((r) => {
12-
if (!r.ok) return Promise.reject(r);
13-
}),
14-
]);
15-
return new Response("OK");
16-
} catch (error: unknown) {
17-
console.log("healthcheck ❌", { error });
18-
return new Response("ERROR", { status: 500 });
19-
}
20-
};
1+
export async function loader() {
2+
return new Response("OK", {
3+
headers: { "Cache-Control": "no-store" },
4+
});
5+
}

0 commit comments

Comments
 (0)