<IfModule mod_headers.c>
  # Cache static assets aggressively
  <FilesMatch "\.(js|css|png|jpg|jpeg|gif|svg|webp|ico|woff2|woff|ttf|eot|json)$">
    Header set Cache-Control "public, max-age=2592000, immutable"
  </FilesMatch>

  # Keep index.html fresh for updates
  <FilesMatch "^(index\.html)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>

  # Service workers should not be cached long-term
  <FilesMatch "^(flutter_service_worker\.js|firebase-messaging-sw\.js)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain text/css application/javascript application/json image/svg+xml
</IfModule>

# SPA fallback (optional). Uncomment if you are hosting this build as a standalone site.
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.html [L]
