File size: 2,453 Bytes
b2d5d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
worker_processes 1;
error_log /tmp/nginx-error.log warn;
pid /tmp/nginx.pid;

events { worker_connections 1024; }

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    access_log    /tmp/nginx-access.log;
    sendfile      on;
    keepalive_timeout 65;
    client_max_body_size 50m;

    client_body_temp_path /tmp/nginx_client_body;
    proxy_temp_path       /tmp/nginx_proxy;
    fastcgi_temp_path     /tmp/nginx_fastcgi;
    uwsgi_temp_path       /tmp/nginx_uwsgi;
    scgi_temp_path        /tmp/nginx_scgi;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
        listen 7860;
        server_name _;

        location = /healthz {
            proxy_pass http://127.0.0.1:1880/;
            proxy_set_header Host $host;
            proxy_hide_header X-Frame-Options;
            proxy_hide_header Cross-Origin-Resource-Policy;
            add_header Content-Security-Policy "frame-ancestors 'self' https://huggingface.co https://*.hf.space;" always;
            add_header Cache-Control "no-store";
        }

        location /einswarm-static/ {
            alias /einswarm/;
            expires 1d;
            add_header Cache-Control "public";
            add_header Content-Security-Policy "frame-ancestors 'self' https://huggingface.co https://*.hf.space;" always;
        }

        location / {
            proxy_pass http://127.0.0.1:1880;
            proxy_http_version 1.1;
            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;
            proxy_set_header Authorization     $http_authorization;
            proxy_set_header Cookie            $http_cookie;
            proxy_set_header Upgrade           $http_upgrade;
            proxy_set_header Connection        $connection_upgrade;
            proxy_pass_header Set-Cookie;
            proxy_hide_header X-Frame-Options;
            proxy_hide_header Cross-Origin-Resource-Policy;
            add_header Content-Security-Policy "frame-ancestors 'self' https://huggingface.co https://*.hf.space;" always;
            proxy_read_timeout 3600s;
            proxy_send_timeout 3600s;
            proxy_buffering off;
        }
    }
}