From 7575fd600d390ca524cd8595ede9057943045c11 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 7 Apr 2024 00:25:28 +0200 Subject: Record metrics for redirects --- src/app.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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(), }, -- cgit 1.4.1