Spaces:
Runtime error
Runtime error
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| default_type application/octet-stream; | |
| upstream streamlit { | |
| server localhost:8501; | |
| } | |
| server { | |
| listen 7860; | |
| server_name localhost; | |
| # Restricted CORS configuration for elevatics.cloud | |
| add_header Access-Control-Allow-Origin "https://elevatics.cloud" always; | |
| add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always; | |
| add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always; | |
| add_header X-Frame-Options "ALLOW-FROM https://elevatics.cloud" always; | |
| add_header Content-Security-Policy "frame-ancestors https://elevatics.cloud" always; | |
| # Handle OPTIONS method | |
| if ($request_method = "OPTIONS") { | |
| add_header Access-Control-Allow-Origin "https://elevatics.cloud" always; | |
| add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always; | |
| add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always; | |
| add_header Access-Control-Max-Age 1728000; | |
| add_header Content-Type text/plain; | |
| add_header Content-Length 0; | |
| return 204; | |
| } | |
| location / { | |
| proxy_pass http://streamlit; | |
| 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_redirect off; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| # Additional security headers for iframe | |
| add_header X-Frame-Options "ALLOW-FROM https://elevatics.cloud" always; | |
| add_header Content-Security-Policy "frame-ancestors https://elevatics.cloud" always; | |
| } | |
| } | |
| } |