[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] improve server-side caching of assets
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a1420f4633d9_381926d46461e@gitlab-sidekiq-low-urgency-cpu-bound-v2-d7f87744c-z2t8r.mail> |
Victor Emanouilov pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki
Commits:
617a8498 by Victor Emanouilov at 2026-05-25T13:14:07+03:00
[FIX] improve server-side caching of assets
---
* [FIX] improve server-side caching of assets - public/generated vs themes/ and _custom/shared receive different levels of cache-control; utilize etags
See merge request tikiwiki/tiki!10172
- - - - -
1 changed file:
- _htaccess
Changes:
=====================================
_htaccess
=====================================
@@ -73,9 +73,8 @@ RedirectMatch 403 /(?:\.git|node_modules)/.*$
#</IfModule>
# -- Client Cache Method -- #
-# Google wants either Last-Modified or ETag. Using ETags will improve the YSlow scores.
-# Option 1: recommended
-FileETag none
+# ETag based on modification time and size
+FileETag MTime Size
<IfModule mod_headers.c>
# -- httpoxy mitigation -- #
@@ -99,17 +98,6 @@ FileETag none
# Uncomment only on full HTTPS; add includeSubDomains/preload only after subdomain audit:
# Header always setifempty Strict-Transport-Security "max-age=63072000"
- # Option 2:
- #Header unset ETag
-
- # -- Client Cache Expiration -- #
- # Google suggests to use Expires in favour of Cache-Control.
- # Option 1: (recommended)
- Header unset Cache-Control
-
- #Option 2:
- #Header unset Expires
-
# -- Persistent Connections -- #
# Allow multiple requests to be sent over the same TCP connection. Enable if you serve a lot of static content
# but, be aware of the possible disadvantages!
@@ -140,22 +128,18 @@ FileETag none
# -- Enable video/audio seek -- #
Header set Accept-Ranges bytes
-</IfModule>
-
-# -- Expires Headers -- #
-# If the site is in active development, you may want to comment out this section.
-<IfModule mod_expires.c>
- <FilesMatch "(?i)\.(gif|png|jpe?g|svgz?|ico)$">
- ExpiresActive on
- ExpiresDefault "access plus 1 month"
- </FilesMatch>
- <FilesMatch "(?i)\.(js|css)$">
- ExpiresActive on
- ExpiresDefault "access plus 1 month"
- </FilesMatch>
- <FilesMatch "(?i)\.(woff|woff2)$">
- ExpiresActive on
- ExpiresDefault "access plus 1 month"
+ # -- Cache-Control Headers -- #
+ # Vite-built assets — cache 30 days
+ <If "%{REQUEST_URI} =~ m#/public/generated/#">
+ Header set Cache-Control "public, max-age=2592000, must-revalidate"
+ </If>
+ # Theme and customization JS/CSS — short cache, always revalidate
+ <If "%{REQUEST_URI} =~ m#/(themes|_custom/shared)/.*\.(js|mjs|css)$#i">
+ Header set Cache-Control "public, max-age=3600, must-revalidate"
+ </If>
+ # Images and fonts — moderate cache
+ <FilesMatch "(?i)\.(gif|png|jpe?g|svgz?|ico|woff2?|ttf|eot|otf)$">
+ Header set Cache-Control "public, max-age=86400, must-revalidate"
</FilesMatch>
</IfModule>
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/617a84981773b17374d7ce31c45500a5b7e09805
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/617a84981773b17374d7ce31c45500a5b7e09805
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs