all repos — website @ f9b4f8dc9b3e918d577bf61763e3b9cf1f0a7891

My website

Redirect existing index.html files

Alan Pearce
commit

f9b4f8dc9b3e918d577bf61763e3b9cf1f0a7891

parent

6cabd370fc9d22e5b15c4627eaf1660ae7cafc33

1 file changed, 11 insertions(+), 0 deletions(-)

changed files
M src/app.tssrc/app.ts
@@ -214,6 +214,17 @@ return new Response("", {
status: status, headers: { location: newpath }, }); + } else if (files.has(pathname.replace(/index.html$/, ""))) { + newpath = pathname.replace(/index.html$/, ""); + metrics.requests.inc({ + method: request.method, + path: newpath, + status_code: (status = 302), + }); + return new Response("", { + status: status, + headers: { location: newpath }, + }); } metrics.requests.inc({ method: request.method,