Skip to content

Commit 62ac5dd

Browse files
committed
Fixed the healthcheck endpoint (hopefully) on https
1 parent 23c93a5 commit 62ac5dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/webapp/app/routes/healthcheck.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ export const loader: LoaderFunction = async ({ request }) => {
77

88
try {
99
const url = new URL("/", `http://${host}`);
10+
11+
if (request.headers.get("x-forwarded-proto") === "https") {
12+
url.protocol = "https:";
13+
}
1014
// if we can connect to the database and make a simple query
1115
// and make a HEAD request to ourselves, then we're good.
1216
await Promise.all([
1317
prisma.user.count(),
14-
fetch(url.toString(), { method: "HEAD" }).then((r) => {
18+
fetch(url.href, { method: "HEAD" }).then((r) => {
1519
if (!r.ok) return Promise.reject(r);
1620
}),
1721
]);

0 commit comments

Comments
 (0)