about summary refs log tree commit diff stats
path: root/src/app.ts
diff options
context:
space:
mode:
authorAlan Pearce2024-04-07 00:25:28 +0200
committerAlan Pearce2024-04-07 00:25:28 +0200
commit7575fd600d390ca524cd8595ede9057943045c11 (patch)
tree670c78b7a9788b2a9cd8ed11b6d1477363fff379 /src/app.ts
parent280e1745f68d35427464c5ec20159a7957e700cb (diff)
downloadwebsite-7575fd600d390ca524cd8595ede9057943045c11.tar.lz
website-7575fd600d390ca524cd8595ede9057943045c11.tar.zst
website-7575fd600d390ca524cd8595ede9057943045c11.zip
Record metrics for redirects
Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/app.ts b/src/app.ts
index 4765811..9735e79 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -157,8 +157,15 @@ export const server = {
         config.redirect_other_hostnames &&
         hostname !== expectedHostURL.host
       ) {
+        metrics.requests.inc({
+          method: request.method,
+          hostname,
+          content_encoding: "identity",
+          path: pathname,
+          status_code: (status = 301),
+        });
         return new Response("", {
-          status: (status = 301),
+          status,
           headers: {
             location: new URL(pathname, expectedHostURL).toString(),
           },