fix(server): use originalUrl in request logger and suppress .well-known noise

- Changed logging middleware to use req.originalUrl instead of req.path,
  which was mangled by Express wildcard catch-all path stripping
- Suppress Chrome DevTools /.well-known/ requests from logs (debug-only)
This commit is contained in:
jgor20
2026-01-28 23:02:00 +00:00
parent 43d0818c3f
commit b012fe0245

View File

@@ -186,10 +186,10 @@ app.use((req, res, next) => {
res.on('finish', () => {
const duration = Date.now() - start;
const status = res.statusCode;
const logMsg = `[${req.method}] ${req.path} ${status} (${duration}ms)`;
const logMsg = `[${req.method}] ${req.originalUrl} ${status} (${duration}ms)`;
// Skip standard logging for event logging batch unless in debug mode
if (req.path === '/api/event_logging/batch' || req.path === '/v1/messages/count_tokens') {
if (req.originalUrl === '/api/event_logging/batch' || req.originalUrl === '/v1/messages/count_tokens' || req.originalUrl.startsWith('/.well-known/')) {
if (logger.isDebugEnabled) {
logger.debug(logMsg);
}