Hi everyone, I am currently running Caddy v2.8.4 on an Ubuntu 24.04 LTS server as the primary reverse proxy in front of an application backend running on localhost:8080. The service performs external domain authority checks and metrics aggregation, which typically takes anywhere from 15 to 45 seconds to complete depending on upstream API latency.
The main problem I am running into is that requests taking longer than 30 seconds consistently fail with a 504 Gateway Timeout error generated by Caddy, even though the backend process finishes successfully in the background. A related issue is that when the application tries to stream incremental progress updates back to the browser via Server-Sent Events, Caddy appears to hold onto the buffer rather than flushing chunks immediately, which eventually causes clients to drop the connection entirely. You can observe the general workflow and query latency here during multi-domain analysis runs.
So far I have tried modifying the reverse_proxy configuration using transport http with dial_timeout and read_timeout increased to 60s, along with setting flush_interval to -1 for the streaming endpoint, but the downstream connections are still closing prematurely when multiple users run checks concurrently. Could anyone clarify if there are additional reverse_proxy transport directives, write timeouts, or global buffer settings in Caddy v2 required to properly support long-running upstream polling without hitting gateway timeouts?