# SPA fallback for Apache/LiteSpeed origins that may serve this build.
# Lovable hosting has built-in SPA fallback and ignores this file, but if the
# custom domain is ever answered by an Apache/LiteSpeed host (stale A record,
# shared hosting), deep links such as /reset-password and /auth/verify must
# still return index.html instead of a 404 page.
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  RewriteRule . /index.html [L]
</IfModule>

# Never let auth entry points be cached by an intermediary.
<FilesMatch "^index\.html$">
  Header set Cache-Control "no-cache, must-revalidate"
</FilesMatch>

# Clickjacking protection. `frame-ancestors` is ignored inside a <meta> CSP, so
# it must be delivered as a real response header (with X-Frame-Options as the
# legacy fallback) on hosts that answer this build.
<IfModule mod_headers.c>
  Header always set Content-Security-Policy "frame-ancestors 'self'"
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
