Spaces:
Running
Running
File size: 1,423 Bytes
5445d68 24ce858 5445d68 |
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 |
server {
listen 7860;
root /usr/share/nginx/html;
index index.html;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.html;
}
location /v1/ {
# Handle CORS preflight to avoid 405 from upstream
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, User-Agent";
add_header Access-Control-Max-Age 3600;
return 204;
}
proxy_pass https://tokyotechlab-be.hf.space/v1/;
proxy_set_header Host tokyotechlab-be.hf.space;
proxy_set_header Authorization "Bearer $HF_API_TOKEN";
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 10000s;
# CORS headers on proxied responses
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, User-Agent";
}
}
|