A server-level types{} block replaced mime.types, so index/JS were served
as application/octet-stream; with nosniff the browser saved them as files.
Co-authored-by: Cursor <cursoragent@cursor.com>
57 lines
1.7 KiB
Nginx Configuration File
57 lines
1.7 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Keep default MIME map (html/js/css). Do NOT put a server-level `types {}`
|
|
# here — it replaces mime.types and forces downloads (octet-stream + nosniff).
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Security headers (Stage 2B §24.3)
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "DENY" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
|
|
# gzip for text payloads (GLB/STL are already compressed/binary)
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_comp_level 6;
|
|
gzip_types text/plain text/css application/json application/javascript text/javascript image/svg+xml;
|
|
|
|
location = /version.json {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# 3D models only — scoped types override (does not wipe html/js MIME)
|
|
location /models/ {
|
|
types {
|
|
model/gltf-binary glb;
|
|
model/stl stl;
|
|
application/octet-stream bin;
|
|
}
|
|
default_type application/octet-stream;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
location /draco/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|