Prevents PyTorch/Docling pipeline crashes on HF Spaces CPU by: - Reducing max file size from 50 MB to 5 MB - Adding configurable MAX_PAGE_COUNT setting (env var, default unlimited) - Increasing conversion timeout from 600s to 900s - Adding frontend upload validation with explicit error messages - Exposing maxPageCount via /api/health for dynamic UI hints
25 lines
665 B
Nginx Configuration File
25 lines
665 B
Nginx Configuration File
server {
|
|
listen 3000;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 900s;
|
|
proxy_send_timeout 900s;
|
|
client_max_body_size 5M;
|
|
}
|
|
}
|