Spaces:
Sleeping
Sleeping
| server { | |
| listen 7860; | |
| server_name _; | |
| # Serve React frontend static files | |
| root /app/static; | |
| index index.html; | |
| # Static assets with caching | |
| location /assets/ { | |
| expires 1y; | |
| add_header Cache-Control "public, immutable"; | |
| } | |
| # Proxy /api/* to FastAPI backend | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:8000; | |
| 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; | |
| # SSE streaming support (for /api/chat) | |
| proxy_buffering off; | |
| proxy_cache off; | |
| proxy_read_timeout 300s; | |
| add_header X-Accel-Buffering no; | |
| } | |
| # MapLibre GL tiles proxy (optional: avoid CORS issues in some envs) | |
| location /tiles/ { | |
| proxy_pass https://tile.openstreetmap.org/; | |
| proxy_set_header Host tile.openstreetmap.org; | |
| expires 1d; | |
| } | |
| # React Router: all non-asset routes → index.html (SPA fallback) | |
| location / { | |
| try_files $uri $uri/ /index.html; | |
| } | |
| # Health check | |
| location /health { | |
| return 200 "OK"; | |
| add_header Content-Type text/plain; | |
| } | |
| # Gzip compression | |
| gzip on; | |
| gzip_types text/plain application/json application/javascript text/css; | |
| gzip_min_length 1024; | |
| } | |