Spaces:
Running
Running
| 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"; | |
| } | |
| } | |