Add nginx reverse proxy for /api and /health to backend server

The frontend builds with VITE_API_URL=/api so all API calls target
the same origin. Without a proxy rule, nginx was serving index.html
for API paths, causing JSON parse errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 19:59:32 -04:00
parent 2ab097ec8a
commit 6cf5bf76b3
+11
View File
@@ -3,6 +3,17 @@ server {
root /usr/share/nginx/html;
index index.html;
location /api/ {
proxy_pass http://server:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /health {
proxy_pass http://server:3001;
}
location / {
try_files $uri $uri/ /index.html;
}