pdfjs worker'ı Vite tarafından pdf.worker.min-<hash>.mjs olarak üretiliyor. Debian nginx'in mime.types dosyasında mjs uzantısı olmadığından dosya application/octet-stream ile geliyor; tarayıcılar modül worker'ını yalnızca JavaScript MIME tipiyle yüklediği için her PDF yüklemesinde "Setting up fake worker failed: Failed to fetch dynamically imported module" hatası çıkıyor, belge analizi tamamlanamıyordu. mjs → application/javascript eşlemesi eklendi (nginx -t ile doğrulandı). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
44 lines
1.3 KiB
Nginx Configuration File
44 lines
1.3 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
include /etc/nginx/mime.types;
|
||
# Vite, pdf.js worker'ını .mjs uzantısıyla üretiyor; Debian'ın mime.types
|
||
# dosyasında mjs yok → application/octet-stream sunuluyordu ve tarayıcı
|
||
# modül worker'ını yüklemeyi reddediyordu ("Setting up fake worker failed").
|
||
types {
|
||
application/javascript mjs;
|
||
}
|
||
|
||
# Canlı veri backend'i (aynı container'da Node, port 3001)
|
||
location /api/ {
|
||
proxy_pass http://127.0.0.1:3001;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
# Belge yükleme: arayüz 10 MB'a izin veriyor, base64 ile ~13,4 MB gövde.
|
||
# nginx varsayılanı 1 MB → 1 MB üstü her dosya 413 ile "yüklenemedi" oluyordu.
|
||
client_max_body_size 20m;
|
||
# Derin şartname analizi 1-2 dk sürebiliyor; 60 sn'de 504 kesiyordu.
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
proxy_connect_timeout 10s;
|
||
}
|
||
|
||
# Statik varlıklar
|
||
location /assets/ {
|
||
root /usr/share/nginx/html;
|
||
try_files $uri =404;
|
||
expires 30d;
|
||
add_header Cache-Control "public, no-transform";
|
||
}
|
||
|
||
# SPA yönlendirmesi
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|