From e65fc77d1c07662bc81283806d8162d28b4e1652 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Thu, 7 Dec 2023 13:40:12 +0000 Subject: [PATCH] =?UTF-8?q?The=20healthcheck=20doesn=E2=80=99t=20need=20to?= =?UTF-8?q?=20do=20a=20HEAD=20request=20to=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/webapp/app/routes/healthcheck.tsx | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/apps/webapp/app/routes/healthcheck.tsx b/apps/webapp/app/routes/healthcheck.tsx index e1cfd73fb..05c00945a 100644 --- a/apps/webapp/app/routes/healthcheck.tsx +++ b/apps/webapp/app/routes/healthcheck.tsx @@ -1,24 +1,9 @@ -// learn more: https://fly.io/docs/reference/configuration/#services-http_checks import { prisma } from "~/db.server"; import type { LoaderFunction } from "@remix-run/node"; export const loader: LoaderFunction = async ({ request }) => { - const host = request.headers.get("X-Forwarded-Host") ?? request.headers.get("host"); - try { - const url = new URL("/", `http://${host}`); - - if (request.headers.get("x-forwarded-proto") === "https") { - url.protocol = "https:"; - } - // if we can connect to the database and make a simple query - // and make a HEAD request to ourselves, then we're good. - await Promise.all([ - prisma.user.count(), - fetch(url.href, { method: "HEAD" }).then((r) => { - if (!r.ok) return Promise.reject(r); - }), - ]); + await prisma.user.count(); return new Response("OK"); } catch (error: unknown) { console.log("healthcheck ❌", { error });