File size: 1,246 Bytes
02342a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8925b7
 
 
 
 
 
02342a2
b8925b7
02342a2
 
 
 
 
 
 
 
272bd90
02342a2
 
 
 
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
worker_processes 1;
pid /tmp/nginx.pid;
error_log /dev/stdout info;

events {
    worker_connections 1024;
}

http {
    client_body_temp_path /tmp/client_temp;
    proxy_temp_path /tmp/proxy_temp_path;
    fastcgi_temp_path /tmp/fastcgi_temp;
    uwsgi_temp_path /tmp/uwsgi_temp;
    scgi_temp_path /tmp/scgi_temp;

    access_log /dev/stdout;

    server {
        listen ${PORT};
        
        # Explicitly route OpenEnv API endpoints to FastAPI (port 8000)
        location ~ ^/(reset|step|state|openapi.json|docs|web|assets|health) {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        # Catch-all: Route everything else to Streamlit (port 8501)
        location / {
            proxy_pass http://127.0.0.1:8501;
            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_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_read_timeout 86400;
        }
    }
}