all repos — homestead @ f818573dedb4828e107ba3574e76f5062317dd9f

Code for my website

Redirect existing index.html files

Alan Pearce
commit

f818573dedb4828e107ba3574e76f5062317dd9f

parent

2c6cc1897c9f218e29b8e1f27a67ddbf22f63053

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

jump to
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,