all repos — website @ 9141b1d854544e8e42d35b0a6119d3e48a2092d0

My website

Fix metrics of redirects and /health

Alan Pearce
commit

9141b1d854544e8e42d35b0a6119d3e48a2092d0

parent

56098880b8dc2f78e5cc9f4e060cf6718fd6f789

1 file changed, 13 insertions(+), 13 deletions(-)

changed files
M src/app.tssrc/app.ts
@@ -145,20 +145,20 @@ "http.method": request.method,
"http.user_agent": request.headers.get("user-agent"), }, }); - if (pathname === "/health") { - return new Response("OK", { status: 200 }); - } else if ( - config.redirect_other_hostnames && - request.headers.get("host") !== expectedHostURL.host - ) { - return new Response("", { - status: 301, - headers: { - location: new URL(pathname, expectedHostURL).toString(), - }, - }); - } try { + if (pathname === "/health") { + return new Response("OK", { status: 200 }); + } else if ( + config.redirect_other_hostnames && + request.headers.get("host") !== expectedHostURL.host + ) { + return new Response("", { + status: 301, + headers: { + location: new URL(pathname, expectedHostURL).toString(), + }, + }); + } const file = files.get(pathname); if (file && (await file.handle.exists())) { if (