diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 467f2ef..065cca8 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -17,7 +17,9 @@ server { 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_read_timeout 60s; + # Long enough for the slowest request: a slow local AI model may take up to the 300s + # timeout its settings allow. + proxy_read_timeout 300s; client_max_body_size 512m; } diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 407e0b1..e7883cd 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -48,5 +48,11 @@ export async function readErrorMessage(res: Response, fallback: string) { return data.detail.trim(); } } catch {} + // An HTML page comes from a proxy in front of the backend, not from Thingport. + if (/^<(!doctype|html)/i.test(trimmed)) { + if (res.status === 504) + return "The server took too long to answer, and a proxy in front of Thingport gave up (HTTP 504)."; + return `${fallback} (HTTP ${res.status})`; + } return trimmed; }