From a5b4062176b9c69f22d65e7281c1a924c3a714f2 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 5 Oct 2015 22:58:57 +0100 Subject: [PATCH] Do all mod_deflate configuration in global context Apparently configuring it for one type in vhost context causes all other configuration in global context to be discarded. --- cookbooks/apache/recipes/default.rb | 4 ++++ .../apache/templates/default/deflate.conf.erb | 15 +++++++++++++++ cookbooks/dev/recipes/default.rb | 1 - cookbooks/dev/templates/default/apache.rails.erb | 2 -- cookbooks/owl/recipes/default.rb | 2 -- cookbooks/web/recipes/frontend.rb | 1 - .../web/templates/default/apache.frontend.erb | 5 ----- 7 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 cookbooks/apache/templates/default/deflate.conf.erb diff --git a/cookbooks/apache/recipes/default.rb b/cookbooks/apache/recipes/default.rb index 6c2ee7932..2b412eefc 100644 --- a/cookbooks/apache/recipes/default.rb +++ b/cookbooks/apache/recipes/default.rb @@ -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 index 000000000..a418736e7 --- /dev/null +++ b/cookbooks/apache/templates/default/deflate.conf.erb @@ -0,0 +1,15 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + + # 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 + + diff --git a/cookbooks/dev/recipes/default.rb b/cookbooks/dev/recipes/default.rb index 3620d163d..c31aca83b 100644 --- a/cookbooks/dev/recipes/default.rb +++ b/cookbooks/dev/recipes/default.rb @@ -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" diff --git a/cookbooks/dev/templates/default/apache.rails.erb b/cookbooks/dev/templates/default/apache.rails.erb index 1c3541916..7301fd834 100644 --- a/cookbooks/dev/templates/default/apache.rails.erb +++ b/cookbooks/dev/templates/default/apache.rails.erb @@ -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 %> diff --git a/cookbooks/owl/recipes/default.rb b/cookbooks/owl/recipes/default.rb index 5776feab2..f71623c6e 100644 --- a/cookbooks/owl/recipes/default.rb +++ b/cookbooks/owl/recipes/default.rb @@ -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 diff --git a/cookbooks/web/recipes/frontend.rb b/cookbooks/web/recipes/frontend.rb index 1be89358c..ab6742b01 100644 --- a/cookbooks/web/recipes/frontend.rb +++ b/cookbooks/web/recipes/frontend.rb @@ -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" diff --git a/cookbooks/web/templates/default/apache.frontend.erb b/cookbooks/web/templates/default/apache.frontend.erb index aa2aa1d98..5c149872e 100644 --- a/cookbooks/web/templates/default/apache.frontend.erb +++ b/cookbooks/web/templates/default/apache.frontend.erb @@ -30,11 +30,6 @@ ExpiresActive On RewriteEngine on - # - # Configure on the fly compression - # - AddOutputFilterByType DEFLATE image/svg+xml - # # Add the unique ID to the request headers # -- 2.39.5