# EderE - root .htaccess (cPanel/Apache)

# Correct MIME type for the Web App Manifest
AddType application/manifest+json .webmanifest .json

# Service worker must be served from the root scope with no long-lived cache
<FilesMatch "sw\.js$">
  Header set Cache-Control "no-cache, no-store, must-revalidate"
  Header set Service-Worker-Allowed "/"
</FilesMatch>

# Long cache for versioned static assets (icons); HTML/JS stay revalidated
<FilesMatch "\.(png|jpg|jpeg|webp|svg|woff2?)$">
  Header set Cache-Control "public, max-age=2592000, immutable"
</FilesMatch>

# Force HTTPS (installability + Web Bluetooth/getUserMedia require a secure context)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Basic security headers
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "DENY"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
