diff options
author | Alan Pearce | 2023-11-08 07:37:01 +0100 |
---|---|---|
committer | Alan Pearce | 2023-11-08 07:37:01 +0100 |
commit | 9141b1d854544e8e42d35b0a6119d3e48a2092d0 (patch) | |
tree | be16887e58cda7e0d65baf20394de117229dd15e /src | |
parent | 56098880b8dc2f78e5cc9f4e060cf6718fd6f789 (diff) | |
download | website-9141b1d854544e8e42d35b0a6119d3e48a2092d0.tar.lz website-9141b1d854544e8e42d35b0a6119d3e48a2092d0.tar.zst website-9141b1d854544e8e42d35b0a6119d3e48a2092d0.zip |
Fix metrics of redirects and /health
Diffstat (limited to 'src')
-rw-r--r-- | src/app.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/app.ts b/src/app.ts index 7250a62..6843ccd 100644 --- a/src/app.ts +++ b/src/app.ts @@ -145,20 +145,20 @@ export const server = { "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 ( |