|
| 1 | +# ─── Security Headers ────────────────────────────────────────────────────────── |
| 2 | + |
| 3 | +<IfModule mod_headers.c> |
| 4 | + |
| 5 | + # HSTS: Browsers müssen HTTPS nutzen (1 Jahr, inkl. Subdomains) |
| 6 | + Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" |
| 7 | + |
| 8 | + # Verhindert MIME-Sniffing |
| 9 | + Header always set X-Content-Type-Options "nosniff" |
| 10 | + |
| 11 | + # Schutz gegen Clickjacking |
| 12 | + Header always set X-Frame-Options "SAMEORIGIN" |
| 13 | + |
| 14 | + # Referrer nur über HTTPS weitergeben |
| 15 | + Header always set Referrer-Policy "strict-origin-when-cross-origin" |
| 16 | + |
| 17 | + # Kamera, Mikrofon, etc. deaktivieren sofern nicht benötigt |
| 18 | + Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" |
| 19 | + |
| 20 | + # Cross-Origin Policies |
| 21 | + Header always set Cross-Origin-Opener-Policy "same-origin" |
| 22 | + Header always set Cross-Origin-Embedder-Policy "require-corp" |
| 23 | + Header always set Cross-Origin-Resource-Policy "same-origin" |
| 24 | + |
| 25 | + # Content Security Policy |
| 26 | + # - 'unsafe-inline' für Styles ist nötig da Docusaurus inline CSS injiziert |
| 27 | + # - 'unsafe-inline' + 'unsafe-eval' für Scripts wegen Docusaurus Runtime |
| 28 | + # - cdn.jsdelivr.net & fonts für externe Assets |
| 29 | + Header always set Content-Security-Policy "\ |
| 30 | + default-src 'self'; \ |
| 31 | + script-src 'self' 'unsafe-inline' 'unsafe-eval'; \ |
| 32 | + style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; \ |
| 33 | + font-src 'self' https://fonts.gstatic.com; \ |
| 34 | + img-src 'self' data: https:; \ |
| 35 | + connect-src 'self'; \ |
| 36 | + frame-ancestors 'none'; \ |
| 37 | + base-uri 'self'; \ |
| 38 | + form-action 'self';" |
| 39 | + |
| 40 | +</IfModule> |
| 41 | + |
| 42 | +# ─── Caching ─────────────────────────────────────────────────────────────────── |
| 43 | + |
| 44 | +<IfModule mod_expires.c> |
| 45 | + ExpiresActive On |
| 46 | + |
| 47 | + # HTML: kein Cache (immer aktuell) |
| 48 | + ExpiresByType text/html "access plus 0 seconds" |
| 49 | + |
| 50 | + # Statische Assets: 1 Jahr (Docusaurus nutzt Content-Hashes in Dateinamen) |
| 51 | + ExpiresByType text/css "access plus 1 year" |
| 52 | + ExpiresByType application/javascript "access plus 1 year" |
| 53 | + ExpiresByType image/png "access plus 1 year" |
| 54 | + ExpiresByType image/jpg "access plus 1 year" |
| 55 | + ExpiresByType image/jpeg "access plus 1 year" |
| 56 | + ExpiresByType image/svg+xml "access plus 1 year" |
| 57 | + ExpiresByType image/x-icon "access plus 1 year" |
| 58 | + ExpiresByType application/font-woff2 "access plus 1 year" |
| 59 | +</IfModule> |
| 60 | + |
| 61 | +# ─── Compression ─────────────────────────────────────────────────────────────── |
| 62 | + |
| 63 | +<IfModule mod_deflate.c> |
| 64 | + AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json |
| 65 | +</IfModule> |
0 commit comments