diff --git a/manifests/config.pp b/manifests/config.pp index f84fd2210..d2997299b 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -95,7 +95,7 @@ $proxy_headers_hash_bucket_size = '64', $proxy_http_version = undef, $proxy_read_timeout = '90', - $proxy_redirect = 'off', + $proxy_redirect = undef, $proxy_send_timeout = '90', $proxy_set_header = [ 'Host $host', diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 9071674c7..9f3be6bf2 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -631,6 +631,18 @@ describe 'vhost_location_proxy template content' do [ + { + title: 'should set proxy_redirect', + attr: 'proxy_redirect', + value: 'value', + match: %r{^\s+proxy_redirect\s+value;} + }, + { + title: 'should not set proxy_redirect', + attr: 'proxy_redirect', + value: :undef, + notmatch: %r{proxy_redirect\b} + }, { title: 'should set proxy_cache', attr: 'proxy_cache', diff --git a/templates/vhost/locations/proxy.erb b/templates/vhost/locations/proxy.erb index 003b033a9..5ca57cfd7 100644 --- a/templates/vhost/locations/proxy.erb +++ b/templates/vhost/locations/proxy.erb @@ -1,7 +1,9 @@ proxy_pass <%= @proxy %>; proxy_read_timeout <%= @proxy_read_timeout %>; proxy_connect_timeout <%= @proxy_connect_timeout %>; +<% if @proxy_redirect -%> proxy_redirect <%= @proxy_redirect %>; +<% end -%> <% if @proxy_http_version -%> proxy_http_version <%= @proxy_http_version %>; <% end -%>