Spaces:
Paused
Paused
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| upstream app { | |
| server ux-analyst-ai:3000; | |
| } | |
| server { | |
| listen 80; | |
| server_name localhost; | |
| # Security headers | |
| add_header X-Frame-Options DENY; | |
| add_header X-Content-Type-Options nosniff; | |
| add_header X-XSS-Protection "1; mode=block"; | |
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | |
| # Gzip compression | |
| gzip on; | |
| gzip_vary on; | |
| gzip_min_length 1024; | |
| gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; | |
| # Rate limiting | |
| limit_req_zone $binary_remote_addr zone=api:10m rate=10r/m; | |
| limit_req_zone $binary_remote_addr zone=general:10m rate=100r/m; | |
| # API routes with rate limiting | |
| location /api/ { | |
| limit_req zone=api burst=5 nodelay; | |
| proxy_pass http://app; | |
| 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_connect_timeout 60s; | |
| proxy_send_timeout 60s; | |
| proxy_read_timeout 300s; | |
| } | |
| # Screenshot routes | |
| location /screenshots/ { | |
| limit_req zone=general burst=20 nodelay; | |
| proxy_pass http://app; | |
| 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; | |
| # Cache images | |
| expires 1d; | |
| add_header Cache-Control "public, immutable"; | |
| } | |
| # All other routes | |
| location / { | |
| limit_req zone=general burst=20 nodelay; | |
| proxy_pass http://app; | |
| 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; | |
| } | |
| # Health check | |
| location /health { | |
| access_log off; | |
| proxy_pass http://app/api/health; | |
| } | |
| } | |
| } |