Files
tehran_taj/nginx-spa.conf
T
mahmoodandClaude Sonnet 5.5 387222851c feat(uploads): accept 15 MB / 8000px and every standard image format
- API ceiling 8 MB -> 15 MB, sharp limitInputPixels 64 MP (8000x8000)
- accept AVIF, BMP, TIFF, HEIC/HEIF, JXL alongside JPEG/PNG/WebP/GIF/SVG/PDF;
  fall back to the file extension when the browser sends an empty or
  octet-stream type
- convert formats browsers cannot paint (TIFF, HEIC, JXL) to WebP on upload
- pre-warm 200/400/600/1600 variants so card thumbnails never wait on a render
- nginx: client_max_body_size 20m, proxy_read_timeout 180s (the 1m default
  rejected every real photo with a bare 413, and a slow 8000px render became
  a 504 that left the card thumbnail broken while /uploads worked)
- gallery tile falls back to the original file if a variant fails

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-26 13:30:50 +03:30

54 lines
1.7 KiB
Plaintext

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Uploads are capped at 15 MB by the API; nginx's 1 MB default would reject
# any real photo with a bare 413 before the request ever reached it.
client_max_body_size 20m;
location /api/ {
proxy_pass http://api: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;
}
# The files that say which release is live are never cached: index.html
# (it names the hashed bundles), sw.js (a stale service worker keeps serving
# the old precache) and version.json (the update gate polls it). They used
# to fall under the 6-month rule below, which could pin a browser to an old
# release. Exact matches win over that regex.
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
try_files $uri =404;
}
location = /sw.js {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
try_files $uri =404;
}
location = /version.json {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
try_files $uri =404;
}
location = /manifest.webmanifest {
add_header Cache-Control "no-cache" always;
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.html;
}
# Optional: Cache static assets
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg)$ {
expires 6M;
access_log off;
add_header Cache-Control "public";
}
}