diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 233f78e..92fd40a 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -47,6 +47,9 @@ # The same zone can be used in multiple places. # [*proxy_cache_valid*] - This directive sets the time for caching # different replies. +# [*proxy_method*] - If defined, overrides the HTTP method of the +# request to be passed to the backend. +# [*proxy_set_body*] - If defined, sets the body passed to the backend. # [*auth_basic*] - This directive includes testing name and password # with HTTP Basic Authentication. # [*auth_basic_user_file*] - This directive sets the htpasswd filename for @@ -111,6 +114,8 @@ define nginx::resource::location ( $try_files = undef, $proxy_cache = false, $proxy_cache_valid = false, + $proxy_method = undef, + $proxy_set_body = undef, $auth_basic = undef, $auth_basic_user_file = undef, $priority = 500 diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index aefc272..6732842 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -59,6 +59,9 @@ # The same zone can be used in multiple places. # [*proxy_cache_valid*] - This directive sets the time for caching # different replies. +# [*proxy_method*] - If defined, overrides the HTTP method of the +# request to be passed to the backend. +# [*proxy_set_body*] - If defined, sets the body passed to the backend. # [*auth_basic*] - This directive includes testing name and # password with HTTP Basic Authentication. # [*auth_basic_user_file*] - This directive sets the htpasswd filename for @@ -112,6 +115,8 @@ define nginx::resource::vhost ( $proxy_set_header = [], $proxy_cache = false, $proxy_cache_valid = false, + $proxy_method = undef, + $proxy_set_body = undef, $fastcgi = undef, $fastcgi_params = '/etc/nginx/fastcgi_params', $fastcgi_script = undef, @@ -215,6 +220,8 @@ define nginx::resource::vhost ( proxy_read_timeout => $proxy_read_timeout, proxy_cache => $proxy_cache, proxy_cache_valid => $proxy_cache_valid, + proxy_method => $proxy_method, + proxy_set_body => $proxy_set_body, fastcgi => $fastcgi, fastcgi_params => $fastcgi_params, fastcgi_script => $fastcgi_script, diff --git a/spec/defines/resource_location_spec.rb b/spec/defines/resource_location_spec.rb index 666b6f8..22a89af 100644 --- a/spec/defines/resource_location_spec.rb +++ b/spec/defines/resource_location_spec.rb @@ -65,6 +65,30 @@ describe 'nginx::resource::location' do :value => false, :notmatch => /proxy_cache/ }, + { + :title => 'should set proxy_method', + :attr => 'proxy_method', + :value => 'value', + :match => ' proxy_method value;', + }, + { + :title => 'should not set proxy_method', + :attr => 'proxy_method', + :value => false, + :notmatch => /proxy_method/, + }, + { + :title => 'should set proxy_set_body', + :attr => 'proxy_set_body', + :value => 'value', + :match => ' proxy_set_body value;', + }, + { + :title => 'should not set proxy_set_body', + :attr => 'proxy_set_body', + :value => false, + :notmatch => /proxy_set_body/, + }, { :title => 'should set proxy_pass', :attr => 'proxy', diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb index 33fe514..1b7eb4c 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -8,6 +8,12 @@ <% end -%> proxy_pass <%= @proxy %>; proxy_read_timeout <%= @proxy_read_timeout %>; +<% if @proxy_method -%> + proxy_method <%= @proxy_method %>; +<% end -%> +<% if @proxy_set_body -%> + proxy_set_body <%= @proxy_set_body %>; +<% end -%> <% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> <%= key %> <%= value %>; <% end -%><% end -%>