]> git.openstreetmap.org Git - chef.git/commitdiff
Use the precompressed assets instead of compressing on the fly
authorTom Hughes <tom@compton.nu>
Tue, 18 Jun 2019 07:46:35 +0000 (08:46 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 18 Jun 2019 07:48:26 +0000 (08:48 +0100)
cookbooks/web/templates/default/apache.frontend.erb

index 45683bde272e02a5301a24ab0cf38a8040f6a741..5944e5f18e5f146f3386ba5f8a9a205a3f559588 100644 (file)
 
 <Directory <%= node[:web][:base_directory] %>/rails/public>
   Require all granted
+
+  RewriteCond "%{HTTP:Accept-encoding}" "gzip"
+  RewriteCond "%{REQUEST_FILENAME}\.gz" -s
+  RewriteRule "^(.*)\.(css|js|svg)" "$1\.$2\.gz" [QSA]
+
+  RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
+  RewriteRule "\.js\.gz$"  "-" [T=text/javascript,E=no-gzip:1]
+  RewriteRule "\.svg\.gz$"  "-" [T=image/svg+xml,E=no-gzip:1]
+
+  <FilesMatch "(\.js\.gz|\.css\.gz|\.svg\.gz)$">
+    Header append Content-Encoding gzip
+    Header append Vary Accept-Encoding
+  </FilesMatch>
 </Directory>
 
 <Directory /srv/www.openstreetmap.org/rails/app/assets>