# Hostiva — Apache performance config

# ── Gzip compression for text assets ──
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/json text/plain text/xml
</IfModule>

# ── Static asset browser caching ──
<IfModule mod_expires.c>
  ExpiresActive On
  # CSS + JS — cache 7 days (versioned by filename if you ever change them)
  ExpiresByType text/css                  "access plus 7 days"
  ExpiresByType application/javascript    "access plus 7 days"
  ExpiresByType text/javascript           "access plus 7 days"
  # Fonts + images — cache 30 days
  ExpiresByType image/png                 "access plus 30 days"
  ExpiresByType image/jpeg                "access plus 30 days"
  ExpiresByType image/svg+xml             "access plus 30 days"
  ExpiresByType image/webp                "access plus 30 days"
  ExpiresByType font/woff2                "access plus 30 days"
  # HTML — no cache (always fresh)
  ExpiresByType text/html                 "access plus 0 seconds"
</IfModule>

# ── Cache-Control headers ──
<IfModule mod_headers.c>
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "public, max-age=604800"
  </FilesMatch>
  <FilesMatch "\.(png|jpg|jpeg|svg|webp|woff2)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
  <FilesMatch "\.html$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
</IfModule>

# ── Keep connections alive ──
<IfModule mod_headers.c>
  Header set Connection keep-alive
</IfModule>
