server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Enable gzip gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # CORS for widget embedding add_header Access-Control-Allow-Origin "*" always; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always; add_header Access-Control-Allow-Headers "Content-Type, Authorization" always; # Widget loader script location /widget.js { add_header Content-Type "application/javascript"; expires 1h; } # Static assets location / { try_files $uri $uri/ /index.html; expires 1h; add_header Cache-Control "public, immutable"; } # Health check location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } }