# Visigine — serves the static React build and reverse-proxies API to the # `backend` service over the docker network. Browser sees one origin, so no # CORS handshake is needed for /api/* calls. server { listen 80 default_server; server_name _; client_max_body_size 1m; root /usr/share/nginx/html; index index.html; # Serve text responses as UTF-8. Without this nginx omits the charset and # browsers fall back to a locale guess (Windows-1252 on DE systems), which # turns valid UTF-8 in llms.txt / robots.txt into mojibake (â€", für). charset utf-8; charset_types text/plain text/css text/xml application/javascript application/json image/svg+xml; # AI-discovery files (llms.txt, llms-full.txt, robots.txt): always served as # UTF-8 plain text, never swallowed by the SPA fallback, and readable # cross-origin so any AI crawler or tool can fetch them. location ~* \.txt$ { try_files $uri =404; default_type text/plain; add_header Access-Control-Allow-Origin "*" always; add_header Cache-Control "public, max-age=3600" always; } # SPA fallback so /admin, /impressum, /datenschutz hit React Router. location / { try_files $uri $uri/ /index.html; } # Cache hashed assets aggressively (Vite emits content-hashed filenames). location ~* \.(?:js|css|woff2?|svg|png|jpg|jpeg|gif|webp|ico)$ { try_files $uri =404; expires 30d; add_header Cache-Control "public, immutable"; } # API → backend container. location /api/ { proxy_pass http://backend:3001; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # Strip browser Origin so the backend treats this as same-origin and # skips its CORS allow-list check (we are the only ingress here). proxy_set_header Origin ""; # Analyses can take up to ~10s (fetcher timeout + Mistral call). proxy_read_timeout 30s; proxy_send_timeout 30s; } # Pass-through health probe so `docker compose ps` shows useful state. location = /health { proxy_pass http://backend:3001/health; proxy_set_header Origin ""; access_log off; } }