all repos — website @ 7575fd600d390ca524cd8595ede9057943045c11

My website

Record metrics for redirects

Alan Pearce
commit

7575fd600d390ca524cd8595ede9057943045c11

parent

280e1745f68d35427464c5ec20159a7957e700cb

1 file changed, 8 insertions(+), 1 deletion(-)

changed files
M src/app.tssrc/app.ts
@@ -157,8 +157,15 @@ } else if (
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(), },