From 26fb41d65ae2176660e7a23ab8345793928793fd Mon Sep 17 00:00:00 2001 From: DaCurse Date: Tue, 29 Mar 2022 03:10:05 +0300 Subject: [PATCH] Omit path and query string from healthcheck route (#38) --- app/routes/healthcheck.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/routes/healthcheck.tsx b/app/routes/healthcheck.tsx index 8ca82e9b..79d4a3b0 100644 --- a/app/routes/healthcheck.tsx +++ b/app/routes/healthcheck.tsx @@ -7,11 +7,12 @@ export const loader: LoaderFunction = async ({ request }) => { request.headers.get("X-Forwarded-Host") ?? request.headers.get("host"); try { + const url = new URL("/", `http://${host}`); // 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(`http://${host}`, { method: "HEAD" }).then((r) => { + fetch(url.toString(), { method: "HEAD" }).then((r) => { if (!r.ok) return Promise.reject(r); }), ]);