about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-11-08 07:36:48 +0100
committerAlan Pearce2023-11-08 07:36:48 +0100
commit56098880b8dc2f78e5cc9f4e060cf6718fd6f789 (patch)
treef9f22d9068942becf254e5509f656f58a99ae526
parent6c0b9fb5773f48d86008f737704b735c0787e788 (diff)
downloadwebsite-56098880b8dc2f78e5cc9f4e060cf6718fd6f789.tar.lz
website-56098880b8dc2f78e5cc9f4e060cf6718fd6f789.tar.zst
website-56098880b8dc2f78e5cc9f4e060cf6718fd6f789.zip
Create /health handler
-rwxr-xr-xbun.lockbbin14725 -> 14725 bytes
-rw-r--r--fly.toml4
-rw-r--r--src/app.ts4
-rw-r--r--static/health.txt1
4 files changed, 4 insertions, 5 deletions
diff --git a/bun.lockb b/bun.lockb
index b4d52ec..1cb7655 100755
--- a/bun.lockb
+++ b/bun.lockb
Binary files differdiff --git a/fly.toml b/fly.toml
index 7e09b9b..039c968 100644
--- a/fly.toml
+++ b/fly.toml
@@ -26,6 +26,4 @@ primary_region = "ams"
   interval = "30s"
   method = "GET"
   timeout = "5s"
-  path = "/health.txt"
-  [http_service.checks.headers]
-    Host = "alanpearce.eu"
+  path = "/health"
diff --git a/src/app.ts b/src/app.ts
index 8ba2d8a..7250a62 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -145,7 +145,9 @@ export const server = {
         "http.user_agent": request.headers.get("user-agent"),
       },
     });
-    if (
+    if (pathname === "/health") {
+      return new Response("OK", { status: 200 });
+    } else if (
       config.redirect_other_hostnames &&
       request.headers.get("host") !== expectedHostURL.host
     ) {
diff --git a/static/health.txt b/static/health.txt
deleted file mode 100644
index d86bac9..0000000
--- a/static/health.txt
+++ /dev/null
@@ -1 +0,0 @@
-OK