Genace

SSE proxy buffering: verify progress delivery through your reverse proxy

A generation progress stream can work locally and appear frozen behind a reverse proxy. The model may be advancing while the proxy holds small event records in a buffer. Measure the delivery path before changing polling intervals or resubmitting the generation. This guide configures infrastructure you control; it does not claim that Genace exposes a customer proxy configuration API.

Put the relay behind application authentication

Your backend relay should authenticate the browser’s session, check local operation ownership, and then open the upstream SSE endpoint with the private API key. Do not solve a browser Authorization limitation by placing the key in a query parameter. The reverse proxy should point at that authenticated local relay, not become an unrestricted forwarding service.

An NGINX location for an application relay can look like this. Replace the backend address and path with your actual service and review the timeout policy for your deployment.

location /api/operation-events/ {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 75s;
}

Disabling response buffering is different from changing request-body buffering. The latter is not what determines whether small downstream SSE records arrive promptly. A longer proxy timeout also cannot extend the upstream function’s own lifetime or guarantee uninterrupted network delivery.

Test with a local synthetic event source

Before using a paid generation, run a harmless local endpoint that emits three timestamped SSE records several seconds apart. Connect directly to the backend and then through the proxy using curl --no-buffer. Record arrival time for each event rather than looking only at the final combined text.

If direct delivery is incremental but proxied delivery arrives as one burst, inspect proxy buffering, caching, compression, and any additional CDN layer. If both paths stall, inspect the application relay for body aggregation such as reading the whole response as text before returning it.

Preserve the real stream contract

Genace’s stream route sends text/event-stream with no-cache, no-transform and emits progress, done, or error events. Each record carries JSON state, progress, outputs, and error fields. It does not send encoded video bytes. A terminal progress snapshot may precede a terminal event, so repeated information should not publish the output twice.

The route declares a sixty second maximum duration. Your proxy may disconnect earlier, and a read timeout should not be interpreted as a failed generation. Recover the saved job with a GET snapshot and reconnect only if useful. There are no event IDs or replay cursor in the current formatter.

Operational acceptance checks

Verify events reach the browser individually under your actual proxy chain. Confirm the client parser handles boundaries split across chunks and does not require each network read to contain one event. Test a normal terminal close separately from an unexpected disconnect. Ensure the relay closes its upstream read when the browser leaves to avoid orphaned connections.

Finally, check logs for accidental bearer credentials or signed asset URLs. Stream diagnostics should identify the application operation and saved job, not dump headers.

Continue with SSE protocol handling, chunk parsing, and reconnect recovery.

Continue with code and integration

Where these facts come from