about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/app.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/app.ts b/src/app.ts
index 53433a9..8d08e0b 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -235,6 +235,11 @@ export const server = {
         }
         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",