gzip on; gzip_comp_level 6; gzip_min_length 1024; gzip_types application/javascript application/json application/manifest+json image/svg+xml text/css text/plain; upstream model_delivery_api { server 127.0.0.1:3001; keepalive 16; } # Public application listener. Local administration is deliberately unavailable. server { listen 38080; server_name _; root /usr/share/nginx/html; index index.html; client_max_body_size 64k; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy same-origin always; add_header X-Frame-Options DENY always; location = /local-admin { return 404; } location ^~ /local-admin/ { return 404; } location = /api/local-admin { return 404; } location ^~ /api/local-admin/ { return 404; } location /api/ { proxy_pass http://model_delivery_api/; proxy_http_version 1.1; proxy_set_header Connection ""; 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 https; proxy_connect_timeout 5s; proxy_read_timeout 20s; add_header Cache-Control "no-store" always; } location /assets/ { try_files $uri =404; expires 1y; add_header Cache-Control "public, max-age=31536000, immutable"; } location = /sw.js { try_files $uri =404; add_header Cache-Control "no-cache"; } location = /manifest.webmanifest { try_files $uri =404; default_type application/manifest+json; add_header Cache-Control "no-cache"; } location / { try_files $uri $uri/ /index.html; add_header Cache-Control "no-cache"; } } # Administration listener. Publish this through a separate DSM reverse-proxy # rule restricted to the LAN; never expose or port-forward it to the internet. server { listen 38081; server_name _; root /usr/share/nginx/html; index index.html; client_max_body_size 64k; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy same-origin always; add_header X-Frame-Options DENY always; location /api/ { proxy_pass http://model_delivery_api/; proxy_http_version 1.1; proxy_set_header Connection ""; 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 https; proxy_connect_timeout 5s; proxy_read_timeout 20s; add_header Cache-Control "no-store" always; } location /assets/ { try_files $uri =404; expires 1y; add_header Cache-Control "public, max-age=31536000, immutable"; } location = /sw.js { try_files $uri =404; add_header Cache-Control "no-cache"; } location = /manifest.webmanifest { try_files $uri =404; default_type application/manifest+json; add_header Cache-Control "no-cache"; } location / { try_files $uri $uri/ /index.html; add_header Cache-Control "no-cache"; } }