PROJECTS / nginx.conf
Adeen
Fix: correct Nginx API routing prefix for FastAPI and set explicit relative path in frontend
c8a7575
raw
history blame contribute delete
754 Bytes
server {
listen 7860;
server_name localhost;
# Frontend (Next.js)
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_cache_bypass $http_upgrade;
}
# Backend (FastAPI)
location /api/ {
# Strip the /api/ prefix before sending to FastAPI
rewrite ^/api/(.*) /$1 break;
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}