Skip to content

[Bug]: Logs show"Invalid HTTP request received" #434

@crivetimihai

Description

@crivetimihai

[Bug]: Logs show "Invalid HTTP request received" errors during normal operation #XXX

[2025-07-14 10:38:07 +0100] [2198434] [WARNING] Invalid HTTP request received.

This might be because of a web browser connecting over HTTPS when the server is set to HTTP. Add more logging, retest.

🐛 Bug Description

Priority: Medium (Operations/Stability)

Description:
When running the MCP Gateway with make serve, the logs periodically show "Invalid HTTP request received" errors even during normal operation. These errors appear in the logs without any apparent impact on functionality, but create noise in production logs and may indicate underlying connection handling issues.

📋 Current Behavior

  • Run make serve and wait for the service to stabilize
  • Send normal API requests (which work correctly)
  • Logs show sporadic "Invalid HTTP request received" errors
  • No obvious correlation with specific user actions
  • Error frequency increases over time

Example Log Output:

2025-01-14 10:23:45 INFO     Starting MCP Gateway on http://0.0.0.0:5173
2025-01-14 10:24:12 ERROR    Invalid HTTP request received
2025-01-14 10:24:18 INFO     POST /api/v1/sse 200 OK
2025-01-14 10:24:32 WARNING  Invalid HTTP request received.

🔬 Investigation Areas

1. Potential Root Causes

  • WebSocket upgrade attempts on non-WebSocket endpoints
  • Health check probes from load balancers or monitoring tools
  • Keep-alive timeouts causing connection resets
  • HTTP/2 or HTTP/3 negotiation failures
  • Scanner/bot traffic sending malformed requests
  • SSE connection lifecycle issues

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions