# cPanel (Apache): HTTPS, consent proxy routes, SPA fallback
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Per-person backend address: /api/u/<token>  (SDK appends /consent/<route>)
  RewriteRule ^api/u/([^/]+)/consent/(sessions|validate|withdraw|portal-sessions)/?$ api/proxy.php?t=$1&r=$2 [L,QSA]

  RewriteCond %{REQUEST_URI} !^/api/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ /index.html [L]
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>
