# Rendered to /etc/nginx/conf.d/default.conf at startup, with ${BASE_URL} substituted. # See docker/40-ready2blob-base-url.sh. server { listen 80; server_name _; root /usr/share/nginx/html; include /etc/nginx/snippets/security-headers.conf; gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/css application/javascript image/svg+xml application/json; # Vite emits content-hashed filenames under assets/ — safe to cache forever. location ${BASE_URL}assets/ { include /etc/nginx/snippets/security-headers.conf; add_header Cache-Control "public, max-age=31536000, immutable" always; } # index.html must never be cached, or clients pin to a stale bundle after a redeploy. location = ${BASE_URL}index.html { include /etc/nginx/snippets/security-headers.conf; add_header Cache-Control "no-cache" always; } # No `$uri/` here on purpose: if the directory exists but holds no index file, # nginx answers 403 instead of falling through to the fallback. location / { try_files $uri ${BASE_URL}index.html; } }