Repository navigation
Expand file tree
/
Copy path.htaccess
More file actions
58 lines (49 loc) · 2.16 KB
/
Copy path.htaccess
File metadata and controls
58 lines (49 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Marslink — root Apache config for Hosting24 (mod_rewrite + mod_headers + mod_deflate).
# No directory listings anywhere (would otherwise leak /scripts, /img, /api).
Options -Indexes
# Block access to dotfiles / dev metadata if they ever get uploaded.
<FilesMatch "^\.">
Require all denied
</FilesMatch>
# Block source-control & dev artifacts.
RedirectMatch 404 /\.git
RedirectMatch 404 /node_modules
RedirectMatch 404 /package(-lock)?\.json$
RedirectMatch 404 /(deploy|build)\.sh$
# Block leftover test scripts that embed live API keys (belt + braces — they
# should not be uploaded, but if they ever are, they'll 404 instead of run).
RedirectMatch 404 ^/test_lambert\.php$
RedirectMatch 404 ^/test_nyx\.php$
RedirectMatch 404 ^/lambert-test\.html$
# Long-cache static assets — they're cache-busted via ?v= in HTML.
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|png|jpg|jpeg|webp|gif|svg|ico|glb|gltf|wasm|woff2?)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
<FilesMatch "\.(html|php)$">
Header set Cache-Control "no-cache"
</FilesMatch>
# Modest hardening — no clickjacking, conservative referrer, no MIME sniffing.
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
</IfModule>
# Gzip text-y assets. (Hosting24 supports mod_deflate by default.)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml \
application/javascript application/json application/xml \
image/svg+xml font/ttf font/otf
</IfModule>
# WebAssembly + glTF MIME types (some hosts default these to octet-stream).
<IfModule mod_mime.c>
AddType application/wasm .wasm
AddType model/gltf-binary .glb
AddType model/gltf+json .gltf
</IfModule>
# Force HTTPS — assumes you've enabled the free Let's Encrypt cert in Hosting24.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>