Spaces:
Running
Running
| server { | |
| listen 7860; | |
| server_name _; | |
| root /app/frontend/build; | |
| index index.html; | |
| # Gzip | |
| gzip on; | |
| gzip_types text/plain text/css application/json application/javascript text/javascript; | |
| # Proxy all /api/* requests to the Node.js backend | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:5000; | |
| 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_read_timeout 60s; | |
| } | |
| # Health check pass-through | |
| location /health { | |
| proxy_pass http://127.0.0.1:5000/health; | |
| } | |
| # React SPA — every unknown route serves index.html | |
| location / { | |
| try_files $uri $uri/ /index.html; | |
| } | |
| # Cache static assets aggressively | |
| location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { | |
| expires 1y; | |
| add_header Cache-Control "public, immutable"; | |
| try_files $uri =404; | |
| } | |
| } | |