fix: suppress favicon.ico spam in logs

This commit is contained in:
hermes committed 2026-07-10 02:56:40 +02:00
1 parent 769ba2b4bb
commit 8243b3097d
1 file changed
+9 -2
+9 -2
View File
@@ -621,8 +621,8 @@ await mcpServer.connect(mcpTransport);
const httpServer = http.createServer(async (req, res) => {
const url = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
// Auth gate — skip /health, /images/ and /logs
if (!url.pathname.startsWith('/health') && !url.pathname.startsWith('/images/') && !url.pathname.startsWith('/logs')) {
// Auth gate — skip public paths
if (!url.pathname.startsWith('/health') && !url.pathname.startsWith('/images/') && !url.pathname.startsWith('/logs') && url.pathname !== '/favicon.ico') {
const auth = req.headers.authorization || '';
const expected = `Bearer ${MCP_TOKEN}`;
if (auth !== expected) {
@@ -653,6 +653,13 @@ const httpServer = http.createServer(async (req, res) => {
return;
}
// Suppress favicon requests
if (url.pathname === '/favicon.ico') {
res.statusCode = 204;
res.end();
return;
}
process.stderr.write(`[HTTP] ${req.method} ${url.pathname} -> incoming\n`);
try {