diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 38087591c..9a893f99e 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -530,13 +530,25 @@ :value => 'value', :match => /^[ ]+proxy_cache\s+value;/, }, + { + :title => 'should not set proxy_cache_valid', + :attr => 'proxy_cache_valid', + :value => false, + :notmatch => /proxy_cache_valid\b/ + }, + { + :title => 'should set proxy_cache_valid', + :attr => 'proxy_cache_valid', + :value => 'value', + :match => /^[ ]+proxy_cache_valid\s+value;/, + }, { :title => 'should not set proxy_cache', :attr => 'proxy_cache', :value => false, :notmatch => /proxy_cache\b/ }, - { + { :title => 'should set proxy_pass', :attr => 'proxy', :value => 'value', diff --git a/templates/vhost/locations/proxy.erb b/templates/vhost/locations/proxy.erb index 8f3ccae37..097f6cc8a 100644 --- a/templates/vhost/locations/proxy.erb +++ b/templates/vhost/locations/proxy.erb @@ -1,5 +1,7 @@ <% if @proxy_cache -%> proxy_cache <%= @proxy_cache %>; +<% end -%> +<% if @proxy_cache_valid -%> proxy_cache_valid <%= @proxy_cache_valid %>; <% end -%> proxy_pass <%= @proxy %>;