File size: 1,968 Bytes
542c765
 
 
 
7c429b6
 
542c765
 
 
 
 
 
 
 
 
7c429b6
 
 
 
 
542c765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c429b6
 
542c765
 
 
 
7c429b6
542c765
 
 
 
7c429b6
542c765
 
 
 
7c429b6
542c765
 
 
 
7c429b6
542c765
 
 
7c429b6
 
 
 
 
 
 
 
 
 
 
542c765
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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;
    }
}