Spaces:
Sleeping
Sleeping
fix: proxy bare FastAPI paths through nginx (fixes 405 on POST /grader)
Browse files- nginx.conf +13 -1
nginx.conf
CHANGED
|
@@ -26,7 +26,8 @@ http {
|
|
| 26 |
root /app/ui/dist;
|
| 27 |
index index.html;
|
| 28 |
|
| 29 |
-
# Proxy /api/* → FastAPI on :8000 (strip the /api prefix)
|
|
|
|
| 30 |
location /api/ {
|
| 31 |
proxy_pass http://127.0.0.1:8000/;
|
| 32 |
proxy_set_header Host $host;
|
|
@@ -35,6 +36,17 @@ http {
|
|
| 35 |
proxy_read_timeout 120s;
|
| 36 |
}
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# Serve the Vite SPA — fall back to index.html for client-side routing
|
| 39 |
location / {
|
| 40 |
try_files $uri $uri/ /index.html;
|
|
|
|
| 26 |
root /app/ui/dist;
|
| 27 |
index index.html;
|
| 28 |
|
| 29 |
+
# Proxy /api/* → FastAPI on :8000 (strip the /api prefix).
|
| 30 |
+
# Used by the React UI (client.js calls /api/reset, /api/grader, etc.)
|
| 31 |
location /api/ {
|
| 32 |
proxy_pass http://127.0.0.1:8000/;
|
| 33 |
proxy_set_header Host $host;
|
|
|
|
| 36 |
proxy_read_timeout 120s;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
# Proxy bare FastAPI paths → FastAPI on :8000 (no prefix stripping).
|
| 40 |
+
# Used by the GRPO training script / notebook which calls /reset, /grader, etc.
|
| 41 |
+
# directly without the /api prefix.
|
| 42 |
+
location ~ ^/(reset|step|state|tasks|grader|baseline|forge|oversight)(/.*)?$ {
|
| 43 |
+
proxy_pass http://127.0.0.1:8000;
|
| 44 |
+
proxy_set_header Host $host;
|
| 45 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 46 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 47 |
+
proxy_read_timeout 120s;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
# Serve the Vite SPA — fall back to index.html for client-side routing
|
| 51 |
location / {
|
| 52 |
try_files $uri $uri/ /index.html;
|