# Managed by CADWorld deployment, not a replacement for 1Panel's main config. limit_req_zone $binary_remote_addr zone=cadworld_api:10m rate=10r/s; server { listen 80; server_name cadworld-sim.robotquan.com; location ^~ /.well-known/acme-challenge/ { root /www/acme/cadworld-sim.robotquan.com; default_type text/plain; } location / { return 301 https://cadworld-sim.robotquan.com$request_uri; } } server { listen 443 ssl http2; server_name cadworld-sim.robotquan.com; ssl_certificate /www/ssl/cadworld-sim.robotquan.com/live/cadworld-sim.robotquan.com/fullchain.pem; ssl_certificate_key /www/ssl/cadworld-sim.robotquan.com/live/cadworld-sim.robotquan.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_cache shared:CADWorldTLS:10m; ssl_session_timeout 1d; root /www/sites/cadworld-sim.robotquan.com/current; index index.html; autoindex off; client_max_body_size 64k; client_body_timeout 15s; keepalive_timeout 30s; server_tokens off; add_header Strict-Transport-Security "max-age=31536000" always; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy no-referrer always; # CSP allowlist supports the approved sibling-origin iframe; X-Frame-Options # DENY/SAMEORIGIN would block it in legacy clients (ALLOW-FROM is obsolete). add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' blob:; object-src 'none'; base-uri 'self'; frame-ancestors 'self' https://cadworld.robotquan.com; form-action 'none'" always; # Hash assets cache; all headers remain inherited (no nested add_header). set $cadworld_cache "no-cache"; if ($uri ~ ^/assets/) { set $cadworld_cache "public, max-age=31536000, immutable"; } if ($uri ~ ^/pyodide/) { set $cadworld_cache "public, max-age=86400"; } if ($uri ~ ^/api/) { set $cadworld_cache "no-store"; } add_header Cache-Control $cadworld_cache always; location ^~ /api/decision/v1/ { access_log off; limit_req zone=cadworld_api burst=20 nodelay; limit_req_status 429; proxy_pass http://127.0.0.1:8768; proxy_http_version 1.1; proxy_set_header Host cadworld-sim.robotquan.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header Forwarded ""; proxy_set_header Connection ""; proxy_connect_timeout 5s; proxy_read_timeout 70s; proxy_send_timeout 15s; proxy_buffering off; proxy_hide_header Cache-Control; } location ^~ /api/ { return 404; } location ^~ /physics/ { return 404; } location = /tuning.html { return 404; } location ~ /\. { return 404; } location ~ \.wasm$ { types { application/wasm wasm; } try_files $uri =404; } location / { try_files $uri $uri/ =404; } }