55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# SPA static files
|
|
root /var/www/ops-core/dist;
|
|
index index.html;
|
|
|
|
# React Router history mode
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Reverse proxy to FastAPI (same-origin /api)
|
|
location /api/ {
|
|
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;
|
|
|
|
# keep cookie + auth headers intact
|
|
proxy_pass http://127.0.0.1:8000/;
|
|
}
|
|
|
|
# Backend mounted static (/data) for downloads/preview
|
|
location /data/ {
|
|
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;
|
|
proxy_pass http://127.0.0.1:8000/data/;
|
|
}
|
|
|
|
# SSE: disable buffering to stream tokens immediately
|
|
location = /api/projects/analyze_stream {
|
|
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;
|
|
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 1h;
|
|
proxy_send_timeout 1h;
|
|
chunked_transfer_encoding off;
|
|
add_header X-Accel-Buffering no;
|
|
|
|
proxy_pass http://127.0.0.1:8000/projects/analyze_stream;
|
|
}
|
|
}
|
|
|