SSE streaming added unnecessary complexity and latency due to buffering issues across Node.js event loop, Nginx proxy, and Docker layers. Reverted to a simple synchronous request/response for PDF conversion. Kept extractLlmErrorMessage for user-friendly LLM errors, lazy-loaded pdf-parse, and extended Nginx timeout.
38 lines
1.2 KiB
Nginx Configuration File
38 lines
1.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Import endpoint — long timeout for LLM processing
|
|
location /api/import {
|
|
proxy_pass http://family-budget-backend:3000;
|
|
proxy_http_version 1.1;
|
|
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_cookie_path / /;
|
|
proxy_connect_timeout 5s;
|
|
proxy_read_timeout 600s;
|
|
client_max_body_size 15m;
|
|
}
|
|
|
|
# API — проксируем на backend (сервис из docker-compose)
|
|
location /api {
|
|
proxy_pass http://family-budget-backend:3000;
|
|
proxy_http_version 1.1;
|
|
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_cookie_path / /;
|
|
proxy_connect_timeout 5s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
|
|
# SPA — все остальные пути отдаём index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|