passwords = data_bag_item("matomo", "passwords")
package %w[
+ brotli
+ gzip
php-cli
php-curl
php-mbstring
subscribes :run, "execute[core:update]"
end
+ execute "/opt/matomo-#{version}/matomo/matomo.br" do
+ action :nothing
+ command "brotli -k -9 /opt/matomo-#{version}/matomo/matomo.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ subscribes :run, "execute[custom-matomo-js:update]"
+ end
+
execute "/opt/matomo-#{version}/matomo/matomo.js" do
action :nothing
command "gzip -k -9 /opt/matomo-#{version}/matomo/matomo.js"
subscribes :run, "execute[custom-matomo-js:update]"
end
+ execute "/opt/matomo-#{version}/matomo/piwik.br" do
+ action :nothing
+ command "brotli -k -9 /opt/matomo-#{version}/matomo/piwik.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ subscribes :run, "execute[custom-matomo-js:update]"
+ end
+
execute "/opt/matomo-#{version}/matomo/piwik.js" do
action :nothing
command "gzip -k -9 /opt/matomo-#{version}/matomo/piwik.js"
ExpiresActive On
RewriteEngine on
- RewriteCond "%{HTTP:Accept-encoding}" "gzip"
+ RewriteCond "%{HTTP:Accept-Encoding}" "br"
+ RewriteCond "%{REQUEST_FILENAME}\.br" -s
+ RewriteRule "^(.*)\.js" "$1\.js\.br" [QSA]
+
+ RewriteCond "%{HTTP:Accept-Encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
- RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
+ RewriteRule "\.js\.(br|gz)$" "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
+
+ <FilesMatch "\.js\.br$">
+ Header append Content-Encoding br
+ Header append Vary Accept-Encoding
+ </FilesMatch>
<FilesMatch "\.js\.gz$">
Header append Content-Encoding gzip
Header append Vary Accept-Encoding
</FilesMatch>
- <FilesMatch "(\.js|\.js\.gz)$">
+ <FilesMatch "(\.js|\.js\.gz|\.js\.br)$">
ExpiresDefault "access plus 1 week"
Header set Cache-Control "max-age=604800"
</FilesMatch>