Skip to content

Commit

Permalink
Merge pull request voxpupuli#170 from TelekomCloud/feature/set_proxy_…
Browse files Browse the repository at this point in the history
…method_and_body

Add support for proxy method and body
  • Loading branch information
James Fryman committed Dec 5, 2013
2 parents 9cf92b1 + c07dcc7 commit 66b1dc3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -111,6 +114,8 @@
$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
Expand Down
7 changes: 7 additions & 0 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,6 +115,8 @@
$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,
Expand Down Expand Up @@ -215,6 +220,8 @@
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,
Expand Down
24 changes: 24 additions & 0 deletions spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@
: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',
Expand Down
6 changes: 6 additions & 0 deletions templates/vhost/vhost_location_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>
Expand Down

0 comments on commit 66b1dc3

Please sign in to comment.