all repos — website @ a1f49f7be3189c083f6d69f6939cd092ed54ff90

My website

send textual 404 if not accepting text/html

Alan Pearce
commit

a1f49f7be3189c083f6d69f6939cd092ed54ff90

parent

d7ac66da3ccffb266caed2ebce574a4ab5737e79

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

changed files
M src/app.tssrc/app.ts
@@ -235,6 +235,11 @@ });
} status = 404; const notfound = files.get("/404.html"); + if (!request.headers.get("accept")?.split(",").includes("text/html")) { + return new Response("404 Not Found", { + status, + }); + } if (notfound) { return serveFile(notfound, status, { "content-type": "text/html; charset=utf-8",