ac91737c63
Browser-only PDF editor (React + Vite + pdf-lib + pdf.js + tesseract.js), plus a multi-stage Dockerfile that builds the SPA and serves it from nginx on port 80 with a /health endpoint for Coolify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.2 KiB
Nginx Configuration File
44 lines
1.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json image/svg+xml application/wasm;
|
|
client_max_body_size 1m;
|
|
|
|
# pdf.js worker ships as hashed .mjs; module workers need a JavaScript MIME type.
|
|
location ~* \.mjs$ {
|
|
types { }
|
|
default_type application/javascript;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location = /health {
|
|
access_log off;
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
# Vite assets carry a content hash -> cache forever.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Unhashed static files (fonts, logo, pdf.js cmaps): cache, but revalidate.
|
|
location ~* \.(?:woff2?|ttf|png|jpg|jpeg|gif|ico|webp|svg|bcmap|pfb)$ {
|
|
add_header Cache-Control "public, max-age=86400";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# index.html must always be fresh so users get new releases.
|
|
location / {
|
|
add_header Cache-Control "no-cache";
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|