server {
    listen 80;
    server_name _;

    # FRONTEND (React)
    location / {
        proxy_pass http://frontend:4173/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    # API (backend FastAPI)
    #
    # El front llamará a /api/analysis, /api/auth/login, etc.
    # Esto lo reenviamos al backend en 8000, eliminando el prefijo /api.
    location /api/ {
        proxy_pass http://backend:8000/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    
        proxy_connect_timeout 60s;
        proxy_send_timeout    600s;
        proxy_read_timeout    600s;
        send_timeout          600s;
    }
}
