chore(umami.php, .htaccess): remove duplicate cache rule + clean up cache headers

This commit is contained in:
Cory Dransfeldt 2025-05-18 12:57:39 -07:00
parent 1ebdc56a1f
commit 4f72f68f68
No known key found for this signature in database
4 changed files with 29 additions and 14 deletions

View file

@ -54,7 +54,6 @@ if ($method === 'GET' && preg_match('#^/utils\.js$#', $forwardPath)) {
http_response_code($code);
header('Content-Type: application/javascript; charset=UTF-8');
header('Cache-Control: public, max-age=60');
echo $js;
exit;
}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "coryd.dev",
"version": "6.0.7",
"version": "6.0.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "6.0.7",
"version": "6.0.8",
"license": "MIT",
"dependencies": {
"html-minifier-terser": "7.2.0",

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "6.0.7",
"version": "6.0.8",
"description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module",
"engines": {

View file

@ -101,11 +101,11 @@ RewriteRule .* /403/index.html [L,R=403]
{%- endif %}
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/font-woff2
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
<IfModule mod_brotli.c>
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json application/font-woff2
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
<IfModule mod_expires.c>
@ -113,8 +113,8 @@ RewriteRule .* /403/index.html [L,R=403]
ExpiresDefault "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType text/html "access plus 1 hour"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
@ -128,10 +128,26 @@ RewriteRule .* /403/index.html [L,R=403]
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(css|js|woff2)$">
Header set Cache-Control "public, max-age=31536000"
</FilesMatch>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "public, max-age=3600, must-revalidate"
</FilesMatch>
Header append Vary "Accept-Encoding"
</IfModule>
<IfModule mod_mime.c>
AddType font/woff2 .woff2
AddType font/ttf .ttf
AddType font/otf .otf
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# use brotli if available
RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}.br -f
RewriteRule ^(.*)$ $1.br [QSA,L]
# fallback to gzip
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
</IfModule>