This commit is contained in:
Mikan
2026-06-20 22:21:47 +03:00
parent 8514c63ec6
commit 0e1616d51c
12 changed files with 206 additions and 35 deletions

View File

@@ -5,12 +5,17 @@ server {
root /usr/share/nginx/html;
index index.html;
# SPA fallback
# Gzip for text assets
gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;
# SPA fallback — must be before /api/ location
location / {
try_files $uri $uri/ /index.html;
}
# API + SSE
# API + SSE — proxy to backend container
location /api/ {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
@@ -19,14 +24,27 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# SSE: disable buffering
# SSE: disable buffering, extend timeouts for long-running streams
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
# WebSocket support (in case of future upgrade)
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Static assets (icons, uploads)
# Static assets (icons, uploads) served by backend
location /static/ {
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Health-check passthrough
location = /health {
proxy_pass http://backend:8000/api/health;
}
}