From 36a1a0d4daf8066de22cfd4d6defe17af8d64a7e Mon Sep 17 00:00:00 2001 From: William Yardley Date: Thu, 27 Oct 2016 11:29:54 -0700 Subject: [PATCH] default proxy_redirect to undef in locations (resolves #395) --- manifests/config.pp | 2 +- spec/defines/resource_location_spec.rb | 12 ++++++++++++ templates/vhost/locations/proxy.erb | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 6036f4ddc..e85500275 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -94,7 +94,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 45991af8e..6a75032bb 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 -%>