server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # ── SSE-Endpunkt (kein Puffern, langer Timeout) ──────────── location /api/label-print-agent/events { proxy_pass http://backend:3100/api/label-print-agent/events; proxy_http_version 1.1; proxy_set_header Connection ''; 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; proxy_buffering off; proxy_cache off; proxy_read_timeout 24h; chunked_transfer_encoding on; } # ── API Reverse Proxy → Backend-Container ────────────────── # Im Docker-Netzwerk ist "backend" der Service-Name aus docker-compose. location /api/ { proxy_pass http://backend:3100/api/; 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; proxy_read_timeout 300s; client_max_body_size 50M; } # Webhook ebenfalls zum Backend durchreichen location /webhook/ { proxy_pass http://backend:3100/webhook/; 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; } # ── SPA Fallback ────────────────────────────────────────── location / { try_files $uri $uri/ /index.html; } # Caching für statische Assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Kein Caching für index.html und env-config.js location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } location = /env-config.js { add_header Cache-Control "no-cache, no-store, must-revalidate"; } }