A source PDF is chunked, vectorised and then read by a model a chunk at a time, so a 500 MB upload is not a big file — it is an hour of work nobody asked for and a bucket that grows for ever. The cap is 20 MB, in the config default, in backend/.env which was overriding it at 524288000, and in nginx, which was letting 500M through to be refused by the application afterwards. A backup of .env is beside it. And a document is deleted where the documents are listed. The endpoint has always existed and removes the file, the vector collection and the row — but reaching it meant opening the document first, which is a page you go to in order to extract from it, not somewhere you visit to tidy up. Delete, then Delete it or Keep, in the workbench list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
86 lines
3.5 KiB
Nginx Configuration File
86 lines
3.5 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Who is actually calling.
|
|
#
|
|
# This container sits behind the host's proxy, which puts the caller's
|
|
# address in X-Forwarded-For. Without the two lines below, $remote_addr is
|
|
# the docker bridge for every request on the site — so the backend's
|
|
# per-IP rate limits were one shared bucket: ten bad passwords from
|
|
# anybody locked out everybody for fifteen minutes, and no log line could
|
|
# say who did it.
|
|
#
|
|
# Only addresses inside a private range are trusted to speak for someone
|
|
# else, and the header is then *overwritten* on the way to the backend
|
|
# rather than appended to, so nothing a client sent for itself survives.
|
|
set_real_ip_from 10.0.0.0/8;
|
|
set_real_ip_from 172.16.0.0/12;
|
|
set_real_ip_from 192.168.0.0/16;
|
|
real_ip_header X-Forwarded-For;
|
|
real_ip_recursive on;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
|
|
# 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;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob:; media-src 'self' blob:; connect-src 'self' https://cap.pedshub.com; font-src 'self' https://fonts.gstatic.com; frame-src 'self' https://cap.pedshub.com;" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
|
|
# API proxy to backend
|
|
location /api/ {
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $backend http://backend:8000;
|
|
proxy_pass $backend;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Large file uploads
|
|
client_max_body_size 24M; # 20 MB of PDF plus the multipart wrapper
|
|
proxy_request_buffering off;
|
|
proxy_read_timeout 600s;
|
|
}
|
|
|
|
# Uploaded images proxy to backend
|
|
location /uploads/ {
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $backend http://backend:8000;
|
|
proxy_pass $backend;
|
|
proxy_set_header Host $host;
|
|
# Backend owns private/no-store and Vary; never cache protected media.
|
|
proxy_force_ranges on;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# Hashed build assets are immutable — a new build gets a new filename.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# index.html must never be cached, or a deploy keeps serving the old
|
|
# bundle references and the app appears unchanged after a release.
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, must-revalidate" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
add_header Cache-Control "no-cache, must-revalidate" always;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|