Skip to content

Commit

Permalink
Omit path and query string from healthcheck route (remix-run#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaCurse authored Mar 29, 2022
1 parent cedadcc commit 26fb41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/routes/healthcheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}),
]);
Expand Down

0 comments on commit 26fb41d

Please sign in to comment.