nginx has no MIME type for .mjs, so the pdf.js worker was served as application/octet-stream and browsers refused to load it. Every imported PDF page then showed "Source PDF ... is not available", which looked like missing files. Serve .mjs as text/javascript. The page background now also tells the two failures apart: "not stored on this device" when the source bytes are missing, and "could not display" (with the error logged) when pdf.js fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
39 lines
1 KiB
Nginx Configuration File
39 lines
1 KiB
Nginx Configuration File
# This file is included at http level, so this adds to nginx's MIME table.
|
|
# Browsers refuse to run module scripts (the pdf.js worker) served as octet-stream.
|
|
types {
|
|
text/javascript mjs;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json application/manifest+json image/svg+xml;
|
|
|
|
# Hashed build output never changes.
|
|
location /_app/immutable/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# The service worker and app shell must be re-checked so updates reach clients.
|
|
location = /service-worker.js {
|
|
add_header Cache-Control "no-cache";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# nginx's default MIME table has no entry for the PWA manifest.
|
|
location ~ \.webmanifest$ {
|
|
types { }
|
|
default_type application/manifest+json;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# Client-side app: unknown paths fall back to the SPA shell.
|
|
location / {
|
|
add_header Cache-Control "no-cache";
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|