[object Object]

← back to Doing Viewer

5x sweep 1: /favicon.ico -> 204 (was 404, console error on every load)

ea854b7df36e943491b2159d33648e7da72ed90f · 2026-09-14 00:25:42 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Yk9ehSqj2L4frMztZNM2j

Files touched

Diff

commit ea854b7df36e943491b2159d33648e7da72ed90f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Sep 14 00:25:42 2026 -0700

    5x sweep 1: /favicon.ico -> 204 (was 404, console error on every load)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_017Yk9ehSqj2L4frMztZNM2j
---
 5x/sweep-1.md | 16 ++++++++++++++++
 server.js     |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/5x/sweep-1.md b/5x/sweep-1.md
new file mode 100644
index 0000000..5860e2e
--- /dev/null
+++ b/5x/sweep-1.md
@@ -0,0 +1,16 @@
+# /5x sweep 1 — doing-viewer (http://127.0.0.1:9790)
+
+## Verify (six-way)
+- M1 HTTP contract: PASS (200 text/html)
+- M2 headless render: PASS (417KB screenshot, no blank)
+- M3 automation E2E: **FAIL** — 1 JS error
+- B4 Google Chrome: PASS
+- B5 Safari / B6 Firefox: SKIP (engines not installed, --no-open)
+
+## Caught
+- 1 JS error, reproduced 3/3 with real Chrome: `Failed to load resource: the server responded with a status of 404 (Not Found)`.
+- Root cause: `/favicon.ico` → 404. The browser implicitly requests it; server.js had no favicon route (fell to the default 404 at line 284). The runner's `favicon`-text filter misses it because Chrome's console message for a failed subresource is generic ("Failed to load resource... 404") with no URL.
+
+## Fix
+- server.js: added `if (req.url === '/favicon.ico') { res.writeHead(204); res.end(); return; }` before the default 404. Returns 204 No Content for any client.
+- Restarted pm2 `doing-viewer`. Verified: /favicon.ico → 204, / → 200.
diff --git a/server.js b/server.js
index bc30345..5650415 100644
--- a/server.js
+++ b/server.js
@@ -281,6 +281,10 @@ http.createServer((req, res) => {
     res.end(INDEX);
     return;
   }
+  // Browsers implicitly request /favicon.ico; without a route it 404s and logs a
+  // console error on every page load (caught by /5x, TK-11446 follow-on). Answer
+  // 204 No Content so there's no favicon 404 for any client.
+  if (req.url === '/favicon.ico') { res.writeHead(204); res.end(); return; }
   res.writeHead(404); res.end('not found');
 }).listen(PORT, () => console.log(`doing-viewer on http://127.0.0.1:${PORT}`));
 

← 3fad9e6 TK-11446: exit 0 (not 1) when doing-viewer source :9790 is t  ·  back to Doing Viewer  ·  5x: REPORT.md — clean twice (favicon 404 fixed) 234c987 →