File size: 1,543 Bytes
a7d24e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59dff58
 
 
 
 
a7d24e0
 
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
#this gets copied into the nginx settings during space creation... see dockerfile

server {
    listen 7860;
    server_name localhost;

    # Specific to HF Spaces: Allow larger headers for their proxy setup
    large_client_header_buffers 4 32k;

    proxy_connect_timeout 600;
    proxy_send_timeout 600;
    proxy_read_timeout 600;
    send_timeout 600;

    # Additional headers specific to running behind HF Spaces proxy
    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_set_header X-Forwarded-Host $host;

    client_max_body_size 50M;
    
    # the node.js api runs on localhost:6666
    # here we tell nginx that requests to /API should forward there
    location /api/ {
        #rewrite ^/API/images/(.*) /$1 break;
        proxy_pass http://localhost:6666;
        proxy_buffering on;
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
    }

    #location /API/tts/ {
    #    rewrite ^/API/tts/(.*) /$1 break;
    #    proxy_pass http://localhost:5555;
    #    proxy_http_version 1.1;
    #    proxy_set_header Upgrade $http_upgrade;
    #    proxy_set_header Connection "upgrade";
    #}

    # Required for HF Spaces health checks
    location / {
        proxy_pass http://localhost:6666;
        proxy_buffering on;
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
    }
}