File size: 865 Bytes
99360c1
 
9b47a8c
 
 
 
 
 
 
 
 
 
99360c1
9b47a8c
 
 
 
 
 
99360c1
9b47a8c
 
 
 
 
 
 
 
 
99360c1
9b47a8c
 
 
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
worker_processes 1;
events { worker_connections 1024; }

http {
  access_log off;

  upstream fastapi_upstream { server 127.0.0.1:8000; }
  upstream streamlit_upstream { server 127.0.0.1:8501; }

  server {
    listen 7860;

    # /api/* -> FastAPI (BUT /api prefix is removed before forwarding)
    location /api/ {
      proxy_pass http://fastapi_upstream/;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-Proto $scheme;
    }

    # /admin/* -> Streamlit
    location /admin/ {
      proxy_pass http://streamlit_upstream/;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_read_timeout 86400;
    }

    # root -> admin (because humans love buttons more than endpoints πŸ˜„)
    location = / { return 302 /admin/; }
  }
}