From a6148753cab1bc68f9c1ea16f7fe796d1f17fb37 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Tue, 4 Aug 2026 22:02:09 +0700 Subject: [PATCH] =?UTF-8?q?fix(infra):=209router=20Caddy=20timeouts=20?= =?UTF-8?q?=E2=80=94=20false=20504=20on=20slow=20LLM=20TTFT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 9router combo models (deepseek-v4-flash-free fallback) have TTFT up to 30-40s. Default (proxy) response_header_timeout 30s / read 60s caused false-positive 504 'timeout awaiting response headers' even while 9router was processing. Give the 9router route dedicated long timeouts (response_header 120s, read/write 300s). Syncs /etc/caddy/Caddyfile. --- infra/caddy/Caddyfile.prod | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/infra/caddy/Caddyfile.prod b/infra/caddy/Caddyfile.prod index 879114a..440a18a 100644 --- a/infra/caddy/Caddyfile.prod +++ b/infra/caddy/Caddyfile.prod @@ -53,7 +53,23 @@ tools.asepharyana.my.id, tools.asepharyana.web.id { } 9router.asepharyana.my.id { - import proxy 4014 + # LLM streaming: 9router combo models punya TTFT sampe 30-40s (deepseek, + # fallback chain). Default (proxy) response_header_timeout 30s / read 60s + # bikin false-positive 504 walau 9router masih ngolah. Longgarkan khusus + # biar health-check & request PR-Agent real gak kena timeout transient. + encode zstd gzip + header { + -Server + X-Content-Type-Options "nosniff" + } + reverse_proxy 127.0.0.1:4014 { + transport http { + dial_timeout 3s + response_header_timeout 120s + read_timeout 300s + write_timeout 300s + } + } } pr-agent.asepharyana.my.id {