Files

49 lines
1.9 KiB
ApacheConf
Raw Permalink Normal View History

# KI FWI SA YÉ ? — Apache / o2switch
# Site statique intégralement prérendu. Aucun script inline, aucun domaine tiers :
# la CSP peut donc rester stricte sans exception (playbook §2.10).
<IfModule mod_headers.c>
Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; media-src 'self'; worker-src 'self'; manifest-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; object-src 'none'"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Frame-Options "DENY"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "geolocation=(), camera=(), microphone=(), payment=(), usb=(), interest-cohort=()"
# Le service worker ne doit jamais être servi depuis le cache HTTP,
# sinon une mise à jour du jeu peut ne jamais atteindre l'appareil.
<FilesMatch "sw\.js$">
Header set Cache-Control "no-cache"
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType audio/ogg "access plus 1 year"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(woff2|avif|webp|opus)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
</IfModule>
AddType application/manifest+json .webmanifest
AddType audio/ogg .opus
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# 404 statique et autonome : lisible même si tout le reste échoue.
ErrorDocument 404 /404.html