SVG/JSON files under /species/ have no content hash in their filename, so browsers could serve stale cached versions after updates. Adding Cache-Control: no-cache forces revalidation on every request while still allowing 304 Not Modified for unchanged files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
739 B
Nginx Configuration File
29 lines
739 B
Nginx Configuration File
server {
|
|
listen ${PORT};
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Serve env.js with no-cache so runtime config is always fresh
|
|
location = /env.js {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Assets with long-lived cache (Vite hashes filenames)
|
|
location /assets/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# Species SVGs/JSON: always revalidate (no hash in filename)
|
|
location /species/ {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# SPA fallback — serve index.html for all non-file routes
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|