Knowledge Base · AI infrastructure
Every API endpoint hung: a missing Content-Length
The symptom
Requests to the service's JSON endpoints hung indefinitely when made through the web server, while the same code worked when called directly on the loopback interface. It looked like a proxy problem; the proxy was innocent.
What was actually wrong
The hand-rolled HTTP responder wrote a status line, headers and a body, but never stated the body length and never closed the connection — valid in HTTP/1.0 style, ambiguous for HTTP/1.1 clients and intermediaries, which then wait for more data that will never come.
The fix
The response helper now always sends a Content-Length header and Connection: close, and the service was restarted under its own supervisor. Every endpoint answers immediately afterwards.
What we took away
When a response works on loopback but hangs behind a proxy, suspect framing before routing. In HTTP/1.1 an unframed response is not a finished response — say how long the body is, or how the connection ends.