|
| 1 | +server { |
| 2 | + listen 8080; |
| 3 | + server_name localhost; |
| 4 | + server_tokens off; |
| 5 | + |
| 6 | + root /usr/share/nginx/html; |
| 7 | + |
| 8 | + location = /.well-known/windows-app-web-link { |
| 9 | + default_type application/json; |
| 10 | + alias /usr/share/nginx/html/.well-known/windows-app-web-link; |
| 11 | + add_header Content-Disposition "attachment; filename=windows-app-web-link"; |
| 12 | + } |
| 13 | + |
| 14 | + # Manifest — fetched, never iframed |
| 15 | + location = /addons/outlook/manifest.xml { |
| 16 | + alias /usr/share/nginx/html/addons/outlook/manifest.xml; |
| 17 | + |
| 18 | + add_header Access-Control-Allow-Origin "*"; |
| 19 | + add_header Cache-Control "no-cache, no-store, must-revalidate"; |
| 20 | + add_header X-Frame-Options "DENY"; |
| 21 | + add_header Content-Security-Policy "frame-ancestors 'none'"; |
| 22 | + } |
| 23 | + |
| 24 | + location = /addons/outlook/assets/ { |
| 25 | + return 404; |
| 26 | + } |
| 27 | + |
| 28 | + location ~* ^/addons/outlook/assets/(.+\.(?:css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot))/?$ { |
| 29 | + root /usr/share/nginx/html; |
| 30 | + expires 30d; |
| 31 | + add_header Cache-Control "public, max-age=2592000, immutable" always; |
| 32 | + add_header Access-Control-Allow-Origin "*"; |
| 33 | + add_header Vary "Origin" always; |
| 34 | + } |
| 35 | + |
| 36 | + location = /addons/outlook/ { |
| 37 | + return 404; |
| 38 | + } |
| 39 | + |
| 40 | + location ~ ^/addons/outlook(/.*)?$ { |
| 41 | + alias /usr/share/nginx/html/addons/outlook$1; |
| 42 | + error_page 404 =200 /index.html; |
| 43 | + add_header Cache-Control "no-cache, no-store, must-revalidate"; |
| 44 | + add_header Pragma "no-cache" always; |
| 45 | + add_header Expires 0 always; |
| 46 | + |
| 47 | + set $ms_domains "https://*.live.com https://*.office.com https://*.microsoft.com https://*.office365.com https://*.sharepoint.com"; |
| 48 | + |
| 49 | + set $nonce $request_id; |
| 50 | + |
| 51 | + set $csp "upgrade-insecure-requests; "; |
| 52 | + set $csp "${csp}frame-ancestors ${ms_domains}; "; |
| 53 | + set $csp "${csp}script-src 'nonce-${nonce}' 'strict-dynamic'; "; |
| 54 | + set $csp "${csp}connect-src 'self' ${ms_domains}; "; |
| 55 | + set $csp "${csp}frame-src 'none'; "; |
| 56 | + set $csp "${csp}object-src 'none'; "; |
| 57 | + set $csp "${csp}base-uri 'none'; "; |
| 58 | + |
| 59 | + add_header Content-Security-Policy $csp; |
| 60 | + |
| 61 | + sub_filter 'NONCE_PLACEHOLDER' $nonce; |
| 62 | + sub_filter_once off; |
| 63 | + } |
| 64 | + |
| 65 | + # Serve static files with caching |
| 66 | + location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { |
| 67 | + expires 30d; |
| 68 | + add_header Cache-Control "public, max-age=2592000"; |
| 69 | + } |
| 70 | + |
| 71 | + # Serve static files |
| 72 | + location / { |
| 73 | + try_files $uri $uri/ /index.html; |
| 74 | + # Add no-cache headers |
| 75 | + add_header Cache-Control "no-cache, no-store, must-revalidate"; |
| 76 | + add_header Pragma "no-cache"; # HTTP 1.0 header for backward compatibility |
| 77 | + add_header Expires 0; |
| 78 | + } |
| 79 | + |
| 80 | + # Optionally, handle 404 errors by redirecting to index.html |
| 81 | + error_page 404 =200 /index.html; |
| 82 | +} |
0 commit comments