Spaces:
Running
Running
| server { | |
| listen 7860; | |
| server_name _; | |
| # ββ Backend API endpoints (specific paths only) ββ | |
| # These are the FastAPI endpoints that the frontend proxy routes call | |
| location /analyze { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_read_timeout 120s; | |
| client_max_body_size 20M; | |
| } | |
| location /mock-analyze { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| location /chat { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_read_timeout 60s; | |
| } | |
| location /upload_and_chat { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_read_timeout 120s; | |
| client_max_body_size 20M; | |
| } | |
| # Backend nutrition/exercise API (POST only, called by Next.js proxy routes) | |
| location /nutrition/ { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| location /exercise/ { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| location /docs { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| location /openapi.json { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| location /health { | |
| proxy_pass http://127.0.0.1:8000; | |
| proxy_set_header Host $host; | |
| } | |
| # ββ Everything else goes to Next.js frontend ββ | |
| location / { | |
| proxy_pass http://127.0.0.1:3000; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection 'upgrade'; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_cache_bypass $http_upgrade; | |
| } | |
| } | |