server { listen 3000; root /usr/share/nginx/html; index index.html; # Allow uploads up to 15 MB (receipt images can be several MB) client_max_body_size 15m; # Proxy API calls to the backend container location /api/ { proxy_pass http://backend:8000; 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_read_timeout 120s; # OCR + AI can take a few seconds proxy_send_timeout 120s; } # Proxy non-versioned backend endpoints (health, demo status) location /demo/ { proxy_pass http://backend:8000; 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; } location /health { proxy_pass http://backend:8000; proxy_set_header Host $host; } # All other routes → index.html (React SPA) location / { try_files $uri $uri/ /index.html; } # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml; }