server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Rabbit photos can be a few MB and CSV/JSON imports are allowed up to 10 MB # (multer's fileSize limit, which counts only the file). nginx counts the whole # request body including multipart framing, so give it headroom above 10m — # otherwise an import file near the cap 413s here before the server can reply. client_max_body_size 12m; # API and uploaded files are reverse-proxied to the Node server so the whole # app stays same-origin (session cookies, relative fetch URLs all just work). # "server" is the service name from docker-compose.yml. location /api/ { proxy_pass http://server:3001; # Pedigree scans wait on an AI model and can take a minute or more; the # default 60s read timeout would cut them off with a 504. proxy_read_timeout 180s; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /uploads/ { proxy_pass http://server:3001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # The service worker must never be served stale, or clients can get pinned to # an old shell that points at a renamed bundle. location = /sw.js { add_header Cache-Control "no-cache"; } # SPA fallback: unknown paths are client-side routes, so serve index.html. location / { try_files $uri $uri/ /index.html; } }