server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } location = /manifest.webmanifest { default_type application/manifest+json; add_header Cache-Control "public, max-age=3600" always; } location = /services.json { default_type application/json; add_header Cache-Control "no-cache" always; } location = /sw.js { default_type application/javascript; expires off; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; } # Matrix Server Delegation (.well-known) location /.well-known/matrix/server { default_type application/json; add_header Access-Control-Allow-Origin * always; return 200 '{"m.server": "matrix.mischlabs.de:443"}'; } # Matrix Client Delegation (.well-known) location /.well-known/matrix/client { default_type application/json; add_header Access-Control-Allow-Origin * always; return 200 '{"m.homeserver":{"base_url":"https://matrix.mischlabs.de"},"org.matrix.msc3575.proxy":{"url":"https://matrix.mischlabs.de"}}'; } # Cache static assets location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 7d; add_header Cache-Control "public, immutable"; } # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; }