From ad0799f9b0c82725b05fd2698d495555552cbdec Mon Sep 17 00:00:00 2001 From: Christian Kaenzig Date: Tue, 16 Dec 2014 16:48:35 +0100 Subject: [PATCH 1/2] Allow disabling proxy_http_version directive The EPEL 6 repository still has version 1.0.15 which does not support this directive proxy_http_version. Yes, this version is old, but a lot of people prefer not to use a bleeding edge version from nginx.org. --- manifests/config.pp | 4 +++- templates/conf.d/proxy.conf.erb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 88b9b07dc..88c9eaf41 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -106,7 +106,9 @@ } validate_string($multi_accept) validate_array($proxy_set_header) - validate_string($proxy_http_version) + if ($proxy_http_version != false) { + validate_string($proxy_http_version) + } validate_bool($confd_purge) validate_bool($vhost_purge) if ($proxy_cache_path != false) { diff --git a/templates/conf.d/proxy.conf.erb b/templates/conf.d/proxy.conf.erb index bea96fba4..d0801328f 100644 --- a/templates/conf.d/proxy.conf.erb +++ b/templates/conf.d/proxy.conf.erb @@ -8,7 +8,8 @@ proxy_send_timeout <%= @proxy_send_timeout %>; proxy_read_timeout <%= @proxy_read_timeout %>; proxy_buffers <%= @proxy_buffers %>; proxy_buffer_size <%= @proxy_buffer_size %>; -proxy_http_version <%= @proxy_http_version %>; +<% if @proxy_http_version -%> +proxy_http_version <%= @proxy_http_version %>;<% end %> <% @proxy_set_header.each do |header| %> proxy_set_header <%= header %>;<% end %> proxy_headers_hash_bucket_size <%= @proxy_headers_hash_bucket_size %>; From 06e40131e34faaa78f502d182aef68e156c945d1 Mon Sep 17 00:00:00 2001 From: Christian Kaenzig Date: Thu, 18 Dec 2014 11:13:50 +0100 Subject: [PATCH 2/2] Disable proxy_http_version directive by default The default value in nginx::config was the same as nginx's default, so it's not necessary to be set in any version of nginx unless one needs a specific value. This also allows us to use undef when we don't want the directive to be set instead of false. Also added a test for the default case. --- manifests/config.pp | 4 ++-- spec/classes/config_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 88c9eaf41..50cfedd8a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -70,7 +70,7 @@ $proxy_cache_path = false, $proxy_connect_timeout = '90', $proxy_headers_hash_bucket_size = '64', - $proxy_http_version = '1.0', + $proxy_http_version = undef, $proxy_read_timeout = '90', $proxy_redirect = 'off', $proxy_send_timeout = '90', @@ -106,7 +106,7 @@ } validate_string($multi_accept) validate_array($proxy_set_header) - if ($proxy_http_version != false) { + if ($proxy_http_version != undef) { validate_string($proxy_http_version) } validate_bool($confd_purge) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 7222a2527..3503cf255 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -287,6 +287,12 @@ :value => '1.1', :match => 'proxy_http_version 1.1;', }, + { + :title => 'should not set proxy_http_version', + :attr => 'proxy_http_version', + :value => nil, + :notmatch => 'proxy_http_version', + }, { :title => 'should contain ordered appended directives', :attr => 'proxy_set_header',