diff options
author | Alan Pearce | 2024-04-07 00:25:28 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-07 00:25:28 +0200 |
commit | 7575fd600d390ca524cd8595ede9057943045c11 (patch) | |
tree | 670c78b7a9788b2a9cd8ed11b6d1477363fff379 | |
parent | 280e1745f68d35427464c5ec20159a7957e700cb (diff) | |
download | website-7575fd600d390ca524cd8595ede9057943045c11.tar.lz website-7575fd600d390ca524cd8595ede9057943045c11.tar.zst website-7575fd600d390ca524cd8595ede9057943045c11.zip |
Record metrics for redirects
-rw-r--r-- | src/app.ts | 9 |
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(), }, |