map $http_upgrade $xhchat_connection { default upgrade; '' close; } server { listen 80; server_name _; root /usr/share/nginx/html; server_tokens off; access_log off; client_max_body_size 8k; location = /api/v1/inbox { client_max_body_size 96k; proxy_pass http://api:8080; proxy_set_header Host $http_host; } location = /api/v1/key-packages { client_max_body_size 12k; proxy_pass http://api:8080; proxy_set_header Host $http_host; } location /api/v1/attachments/ { client_max_body_size 9m; proxy_pass http://api:8080; proxy_set_header Host $http_host; } add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self'; connect-src 'self'; img-src 'self' blob:; media-src blob:; form-action 'self'; base-uri 'none'; frame-ancestors 'none'" always; add_header Referrer-Policy no-referrer always; add_header X-Content-Type-Options nosniff always; add_header Permissions-Policy "camera=(), microphone=(self), geolocation=()" always; location /api/ { proxy_pass http://api:8080; proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $xhchat_connection; proxy_read_timeout 90s; } location = /healthz { proxy_pass http://api:8080; } location = /readyz { proxy_pass http://api:8080; } location / { try_files $uri $uri/ =404; } }