Proxy Idle Timeouts During Long HTTP Jobs
Choose polling or a defined streaming format when long server work encounters a proxy's idle limit, rather than inserting arbitrary bytes into the final response.
If a service stays silent for minutes and a proxy times out, choose what the client should receive before adding heartbeat bytes. Extending a timer can help one wait; the response contract determines what progress is valid.
| Application design | Progress contract |
|---|---|
| Asynchronous job | 202 Accepted with a representation describing monitoring, followed by finite status requests and explicit completion/failure states |
| Server-Sent Events stream | Content-Type: text/event-stream and records the SSE client understands |
202 does not promise that the job succeeds. For SSE, a comment record can look like:
: heartbeat
The colon makes it a comment rather than an application event. HTML's authoring notes suggest periodic comments roughly every 15 seconds against some legacy proxy idle behavior; that is guidance, not a universal timeout guarantee.
Finish headers and ensure the application/serving stack releases records rather than buffering them locally. Bytes not yet sent cannot keep a downstream intermediary active.
Do not insert SSE comments into ordinary JSON or binary content. An HTTP/1.1 zero-length chunk ends a chunked body, so it is not a repeatable empty heartbeat.
Retain an operation deadline and cancellation policy. Traffic activity alone does not show useful job progress or a valid final result.