Skip to content

Commit

Permalink
Merge pull request #856 from igalic/proxy_buffer
Browse files Browse the repository at this point in the history
add proxy_buffering parameter to location & vhost
  • Loading branch information
3flex authored Aug 23, 2016
2 parents 7b3412f + 4e0756d commit 0d7c634
Show file tree
Hide file tree
Showing 4 changed files with 20 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 @@ -81,6 +81,7 @@
# [*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.
# [*proxy_buffering*] - If defined, sets the proxy_buffering to the passed value.
# [*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 @@ -179,6 +180,7 @@
$proxy_cache_valid = false,
$proxy_method = undef,
$proxy_set_body = undef,
$proxy_buffering = undef,
$auth_basic = undef,
$auth_basic_user_file = undef,
$rewrite_rules = [],
Expand Down Expand Up @@ -309,6 +311,9 @@
if ($proxy_set_body != undef) {
validate_string($proxy_set_body)
}
if ($proxy_buffering != undef) {
validate_re($proxy_buffering, '^(on|off)$')
}
if ($auth_basic != undef) {
validate_string($auth_basic)
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
# [*proxy_read_timeout*] - Override the default the proxy read timeout value
# of 90 seconds
# [*proxy_redirect*] - Override the default proxy_redirect value of off.
# [*proxy_buffering*] - If defined, sets the proxy_buffering to the passed value.
# [*resolver*] - Array: Configures name servers used to resolve
# names of upstream servers into addresses.
# [*fastcgi*] - location of fastcgi (host:port)
Expand Down Expand Up @@ -227,6 +228,7 @@
$proxy_cache_valid = false,
$proxy_method = undef,
$proxy_set_body = undef,
$proxy_buffering = undef,
$resolver = [],
$fastcgi = undef,
$fastcgi_params = "${::nginx::config::conf_dir}/fastcgi_params",
Expand Down Expand Up @@ -401,6 +403,9 @@
if ($proxy_set_body != undef) {
validate_string($proxy_set_body)
}
if ($proxy_buffering != undef) {
validate_re($proxy_buffering, '^(on|off)$')
}
validate_array($resolver)
if ($fastcgi != undef) {
validate_string($fastcgi)
Expand Down Expand Up @@ -608,6 +613,7 @@
proxy_set_header => $proxy_set_header,
proxy_hide_header => $proxy_hide_header,
proxy_set_body => $proxy_set_body,
proxy_buffering => $proxy_buffering,
fastcgi => $fastcgi,
fastcgi_params => $fastcgi_params,
fastcgi_script => $fastcgi_script,
Expand Down
6 changes: 6 additions & 0 deletions spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,12 @@
:value => 'value',
:match => %r'\s+proxy_set_body\s+value;',
},
{
:title => 'should set proxy_buffering',
:attr => 'proxy_buffering',
:value => 'on',
:match => %r'\s+proxy_buffering\s+on;',
},
].each do |param|
context "when #{param[:attr]} is #{param[:value]}" do
let :default_params do { :location => 'location', :proxy => 'proxy_value', :vhost => 'vhost1' } end
Expand Down
3 changes: 3 additions & 0 deletions templates/vhost/locations/proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<% if @proxy_set_body -%>
proxy_set_body <%= @proxy_set_body %>;
<% end -%>
<% if @proxy_buffering -%>
proxy_buffering <%= @proxy_buffering %>;
<% end -%>
<% unless @proxy_set_header.nil? -%>
<%- @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
Expand Down

0 comments on commit 0d7c634

Please sign in to comment.