From 0626b8d496e5864b68330e210745b4e923cb28c9 Mon Sep 17 00:00:00 2001 From: olsch01 Date: Wed, 25 Feb 2026 20:55:05 -0500 Subject: [PATCH] Increase nginx proxy timeout for AI recommendations endpoint The AI recommendation endpoint calls a large language model (397B params) which can take 60-120 seconds to respond. Nginx's default 60s proxy_read_timeout was killing the connection before the response arrived. Added a dedicated location block with 180s timeout for the recommendations endpoint. Co-Authored-By: Claude Opus 4.6 --- nginx/default.conf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nginx/default.conf b/nginx/default.conf index 26f7060..61feae0 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -23,6 +23,22 @@ server { proxy_cache_bypass $http_upgrade; } + # AI recommendation endpoint needs a longer timeout (up to 3 minutes) + location /api/investment-planning/recommendations { + proxy_pass http://backend; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_cache_bypass $http_upgrade; + proxy_read_timeout 180s; + proxy_connect_timeout 10s; + proxy_send_timeout 30s; + } + # Everything else -> Vite dev server (frontend) location / { proxy_pass http://frontend;