all repos — homestead @ ffe116a38b1fc2642d59134ff6495ffb4d68ca04

Code for my website

Record metrics for redirects

Alan Pearce
commit

ffe116a38b1fc2642d59134ff6495ffb4d68ca04

parent

71967a944264b8540bce40dfc0118e65c0ede761

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

jump to
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(), },