# Cache Control Headers for Static Assets
# Requirements: 8.5 - Configure caching headers
# 
# This file is used by Netlify and Cloudflare Pages
# For other platforms, configure headers in their respective config files

# Default headers for all pages
/*
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  Referrer-Policy: strict-origin-when-cross-origin
  Permissions-Policy: camera=(), microphone=(), geolocation=()
  # Required for SharedArrayBuffer (LibreOffice WASM pthreads)
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp
  Cross-Origin-Resource-Policy: cross-origin

# HTML pages - no cache, always revalidate
/*.html
  Cache-Control: public, max-age=0, must-revalidate

# JavaScript files - immutable cache (hashed filenames)
/*.js
  Cache-Control: public, max-age=31536000, immutable

# CSS files - immutable cache (hashed filenames)
/*.css
  Cache-Control: public, max-age=31536000, immutable

# Images - long cache
/*.png
  Cache-Control: public, max-age=31536000, immutable

/*.jpg
  Cache-Control: public, max-age=31536000, immutable

/*.jpeg
  Cache-Control: public, max-age=31536000, immutable

/*.gif
  Cache-Control: public, max-age=31536000, immutable

/*.svg
  Cache-Control: public, max-age=31536000, immutable

/*.webp
  Cache-Control: public, max-age=31536000, immutable

/*.avif
  Cache-Control: public, max-age=31536000, immutable

/*.ico
  Cache-Control: public, max-age=31536000, immutable

# Fonts - long cache
/*.woff
  Cache-Control: public, max-age=31536000, immutable

/*.woff2
  Cache-Control: public, max-age=31536000, immutable

/*.ttf
  Cache-Control: public, max-age=31536000, immutable

/*.eot
  Cache-Control: public, max-age=31536000, immutable

# PDF.js and worker files
/workers/*
  Cache-Control: public, max-age=31536000, immutable

/pdfjs-viewer/*
  Cache-Control: public, max-age=31536000, immutable

# JSON files (translations, etc.)
/*.json
  Cache-Control: public, max-age=3600, stale-while-revalidate=86400

# WASM files
/*.wasm
  Cache-Control: public, max-age=31536000, immutable
  Content-Type: application/wasm

# LibreOffice WASM data files
/libreoffice-wasm/soffice.wasm.gz
  Cache-Control: public, max-age=31536000, immutable
  Content-Type: application/wasm
  Content-Encoding: gzip
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp
  Cross-Origin-Resource-Policy: cross-origin

/libreoffice-wasm/soffice.data.gz
  Cache-Control: public, max-age=31536000, immutable
  Content-Type: application/octet-stream
  Content-Encoding: gzip
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp
  Cross-Origin-Resource-Policy: cross-origin

/libreoffice-wasm/*
  Cache-Control: public, max-age=31536000, immutable
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp
  Cross-Origin-Resource-Policy: cross-origin

# MJS files (ES Modules) - must have correct MIME type
/*.mjs
  Cache-Control: public, max-age=31536000, immutable
  Content-Type: application/javascript

# PDF.js viewer MJS files
/pdfjs-viewer/*.mjs
  Cache-Control: public, max-age=31536000, immutable
  Content-Type: application/javascript
