diff --git a/nginx/snippets/proxy-pass.conf b/nginx/snippets/proxy-pass.conf index 06ffe1a..b84b86a 100644 --- a/nginx/snippets/proxy-pass.conf +++ b/nginx/snippets/proxy-pass.conf @@ -4,11 +4,8 @@ set $upstream_app app:8000; proxy_pass http://$upstream_app; -# No backend synthesis timeout exists today (ffmpeg.py only bounds the -# encode step at 30s; TTS inference itself is unbounded) — pick a ceiling -# safely above realistic worst-case rather than nginx's low defaults cutting -# off legitimate slow requests. -proxy_read_timeout 120s; +# proxy_read_timeout is set per location (nginx rejects a directive repeated in +# one block, so it can't live here and be overridden after the include). proxy_send_timeout 120s; proxy_connect_timeout 5s; diff --git a/nginx/templates/20-speech-server.conf.template b/nginx/templates/20-speech-server.conf.template index 7577de2..d8aa73f 100644 --- a/nginx/templates/20-speech-server.conf.template +++ b/nginx/templates/20-speech-server.conf.template @@ -74,9 +74,8 @@ server { include /etc/nginx/snippets/proxy-pass.conf; # TTS inference is CPU-bound and can be slow (24-layer models, long text, - # emulated arch) — give synthesis more than the shared 120s read timeout so - # a legitimately long generation isn't cut off with a 504. This override must - # come AFTER the include, whose 120s would otherwise win. + # emulated arch) — give synthesis more than the 120s default on other + # routes so a legitimately long generation isn't cut off with a 504. proxy_read_timeout 300s; } @@ -91,5 +90,9 @@ server { limit_conn perip 20; include /etc/nginx/snippets/proxy-pass.conf; + + # No backend timeout exists today (TTS inference is unbounded) — pick a + # ceiling safely above realistic worst-case rather than nginx's low default. + proxy_read_timeout 120s; } }