Do all mod_deflate configuration in global context
authorTom Hughes <tom@compton.nu>
Mon, 5 Oct 2015 21:58:57 +0000 (22:58 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 5 Oct 2015 21:58:57 +0000 (22:58 +0100)
Apparently configuring it for one type in vhost context causes
all other configuration in global context to be discarded.

cookbooks/apache/recipes/default.rb
cookbooks/apache/templates/default/deflate.conf.erb [new file with mode: 0644]
cookbooks/dev/recipes/default.rb
cookbooks/dev/templates/default/apache.rails.erb
cookbooks/owl/recipes/default.rb
cookbooks/web/recipes/frontend.rb
cookbooks/web/templates/default/apache.frontend.erb

index 6c2ee7932deb4d544437d722e499a91757cc7245..2b412eefca9fe0d270b6883425e2eec6bdb132ef 100644 (file)
@@ -77,6 +77,10 @@ apache_module "status" do
   variables :hosts => admins["hosts"]
 end
 
+apache_module "deflate" do
+  conf "deflate.conf.erb"
+end
+
 apache_module "reqtimeout" do
   action [:disable]
 end
diff --git a/cookbooks/apache/templates/default/deflate.conf.erb b/cookbooks/apache/templates/default/deflate.conf.erb
new file mode 100644 (file)
index 0000000..a418736
--- /dev/null
@@ -0,0 +1,15 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<IfModule mod_deflate.c>
+        <IfModule mod_filter.c>
+                # these are known to be safe with MSIE 6
+                AddOutputFilterByType DEFLATE text/html text/plain text/xml
+
+                # everything else may cause problems with MSIE 6
+                AddOutputFilterByType DEFLATE text/css
+                AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
+                AddOutputFilterByType DEFLATE application/rss+xml
+                AddOutputFilterByType DEFLATE application/xml
+                AddOutputFilterByType DEFLATE image/svg+xml
+        </IfModule>
+</IfModule>
index 3620d163d82fa4a59be035e109bbb4c164ce6cf9..c31aca83b075830135b9139f64ced44c6ef2e0bc 100644 (file)
@@ -59,7 +59,6 @@ nodejs_package "svgo"
 easy_install_package "geojson"
 
 apache_module "env"
-apache_module "deflate"
 apache_module "expires"
 apache_module "proxy"
 apache_module "proxy_fcgi"
index 1c3541916ae8b836a0975a0de3b5073d528fcd48..7301fd83415761ed75b199413d085b2a5cbe7d0d 100644 (file)
@@ -12,8 +12,6 @@
         CustomLog /var/log/apache2/<%= @name %>-access.log combined
         ErrorLog /var/log/apache2/<%= @name %>-error.log
 
-        AddOutputFilterByType DEFLATE image/svg+xml
-
         RailsEnv production
 
         SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
index 5776feab2b2d025d38870e80bf4fae6d4a6ba8a8..f71623c6eba0291840f9b5881ec9e9036ff143c8 100644 (file)
@@ -36,8 +36,6 @@ gem_package "bundler#{node[:owl][:ruby]}" do
   options "--format-executable"
 end
 
-apache_module "deflate"
-
 apache_module "passenger" do
   conf "passenger.conf.erb"
 end
index 1be89358c4b874830ead201b4fca95c88ca12e77..ab6742b01247f006cbda6cd8027164f27ae5f349 100644 (file)
@@ -23,7 +23,6 @@ include_recipe "web::rails"
 web_passwords = data_bag_item("web", "passwords")
 
 apache_module "alias"
-apache_module "deflate"
 apache_module "expires"
 apache_module "headers"
 apache_module "proxy_http"
index aa2aa1d98dc38565c28aaea24ca6a210f0b229a5..5c149872e9f63c8097fc6d1ce97cba59184c6a33 100644 (file)
   ExpiresActive On
   RewriteEngine on
 
-  #
-  # Configure on the fly compression
-  #
-  AddOutputFilterByType DEFLATE image/svg+xml
-
   #
   # Add the unique ID to the request headers
   #