about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/app.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/app.ts b/src/app.ts
index 7250a62..6843ccd 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -145,20 +145,20 @@ export const server = {
         "http.user_agent": request.headers.get("user-agent"),
       },
     });
-    if (pathname === "/health") {
-      return new Response("OK", { status: 200 });
-    } else if (
-      config.redirect_other_hostnames &&
-      request.headers.get("host") !== expectedHostURL.host
-    ) {
-      return new Response("", {
-        status: 301,
-        headers: {
-          location: new URL(pathname, expectedHostURL).toString(),
-        },
-      });
-    }
     try {
+      if (pathname === "/health") {
+        return new Response("OK", { status: 200 });
+      } else if (
+        config.redirect_other_hostnames &&
+        request.headers.get("host") !== expectedHostURL.host
+      ) {
+        return new Response("", {
+          status: 301,
+          headers: {
+            location: new URL(pathname, expectedHostURL).toString(),
+          },
+        });
+      }
       const file = files.get(pathname);
       if (file && (await file.handle.exists())) {
         if (