Skip to content

Commit

Permalink
Introduce two new optional proxy parameters
Browse files Browse the repository at this point in the history
We want to be able to manage the configuration values of:
proxy_busy_buffers_size and proxy_max_temp_file_size
  • Loading branch information
ruriky authored and bastelfreak committed Dec 28, 2018
1 parent 8dbd380 commit f30a773
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
$nginx_cfg_prepend = $nginx::nginx_cfg_prepend
$proxy_buffers = $nginx::proxy_buffers
$proxy_buffer_size = $nginx::proxy_buffer_size
$proxy_busy_buffers_size = $nginx::proxy_busy_buffers_size
$proxy_cache_inactive = $nginx::proxy_cache_inactive
$proxy_cache_keys_zone = $nginx::proxy_cache_keys_zone
$proxy_cache_levels = $nginx::proxy_cache_levels
Expand All @@ -105,6 +106,7 @@
$proxy_connect_timeout = $nginx::proxy_connect_timeout
$proxy_headers_hash_bucket_size = $nginx::proxy_headers_hash_bucket_size
$proxy_http_version = $nginx::proxy_http_version
$proxy_max_temp_file_size = $nginx::proxy_max_temp_file_size
$proxy_read_timeout = $nginx::proxy_read_timeout
$proxy_redirect = $nginx::proxy_redirect
$proxy_send_timeout = $nginx::proxy_send_timeout
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
Array $proxy_hide_header = [],
Array $proxy_pass_header = [],
Array $proxy_ignore_header = [],
Optional[Nginx::Size] $proxy_max_temp_file_size = undef,
Optional[Nginx::Size] $proxy_busy_buffers_size = undef,
Enum['on', 'off'] $sendfile = 'on',
Enum['on', 'off'] $server_tokens = 'on',
Enum['on', 'off'] $spdy = 'off',
Expand Down
5 changes: 5 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
# [*proxy_set_body*] - If defined, sets the body passed to the backend.
# [*proxy_buffering*] - If defined, sets the proxy_buffering to the passed
# value.
# [*proxy_max_temp_file_size*] - Sets the maximum size of the temporary buffer file.
# [*proxy_busy_buffers_size*] - Sets the total size of buffers that can be
# busy sending a response to the client while the response is not yet fully read.
# [*absolute_redirect*] - Enables or disables the absolute redirect functionality of nginx
# [*auth_basic*] - This directive includes testing name and password
# with HTTP Basic Authentication.
Expand Down Expand Up @@ -224,6 +227,8 @@
Optional[String] $proxy_http_version = undef,
Optional[String] $proxy_set_body = undef,
Optional[Enum['on', 'off']] $proxy_buffering = undef,
Optional[Nginx::Size] $proxy_max_temp_file_size = undef,
Optional[Nginx::Size] $proxy_busy_buffers_size = undef,
Optional[Enum['on', 'off']] $absolute_redirect = undef,
Optional[String] $auth_basic = undef,
Optional[String] $auth_basic_user_file = undef,
Expand Down
7 changes: 7 additions & 0 deletions manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
# [*proxy_send_timeout*] - Override the default proxy send 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.
# [*proxy_max_temp_file_size*] - Sets the maximum size of the temporary buffer file.
# [*proxy_busy_buffers_size*] - Sets the total size of buffers that can be
# busy sending a response to the client while the response is not yet fully read.
# [*resolver*] - Array: Configures name servers used to resolve names of upstream servers into addresses.
# [*fastcgi*] - location of fastcgi (host:port)
# [*fastcgi_param*] - Set additional custom fastcgi_params
Expand Down Expand Up @@ -203,6 +206,8 @@
Optional[String] $proxy_http_version = undef,
Optional[String] $proxy_set_body = undef,
Optional[String] $proxy_buffering = undef,
Optional[Nginx::Size] $proxy_max_temp_file_size = undef,
Optional[Nginx::Size] $proxy_busy_buffers_size = undef,
Array $resolver = [],
Optional[String] $fastcgi = undef,
Optional[String] $fastcgi_index = undef,
Expand Down Expand Up @@ -373,6 +378,8 @@
proxy_set_body => $proxy_set_body,
proxy_cache_bypass => $proxy_cache_bypass,
proxy_buffering => $proxy_buffering,
proxy_busy_buffers_size => $proxy_busy_buffers_size,
proxy_max_temp_file_size => $proxy_max_temp_file_size,
fastcgi => $fastcgi,
fastcgi_index => $fastcgi_index,
fastcgi_param => $fastcgi_param,
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,18 @@
attr: 'proxy_temp_path',
value: '/path/to/proxy_temp',
match: ' proxy_temp_path /path/to/proxy_temp;'
},
{
title: 'should set proxy_max_temp_file_size',
attr: 'proxy_max_temp_file_size',
value: '1024m',
match: ' proxy_max_temp_file_size 1024m;'
},
{
title: 'should set proxy_busy_buffers_size',
attr: 'proxy_busy_buffers_size',
value: '16k',
match: ' proxy_busy_buffers_size 16k;'
}
].each do |param|
context "when #{param[:attr]} is #{param[:value]}" do
Expand Down
12 changes: 12 additions & 0 deletions spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,18 @@
attr: 'proxy_buffering',
value: 'on',
match: %r{\s+proxy_buffering\s+on;}
},
{
title: 'should set proxy_max_temp_file_size',
attr: 'proxy_max_temp_file_size',
value: '1024m',
match: %r{\s+proxy_max_temp_file_size\s+1024m;}
},
{
title: 'should set proxy_busy_buffers_size',
attr: 'proxy_busy_buffers_size',
value: '16k',
match: %r{\s+proxy_busy_buffers_size\s+16k;}
}
].each do |param|
context "when #{param[:attr]} is #{param[:value]}" do
Expand Down
6 changes: 6 additions & 0 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ http {
<% if @proxy_buffer_size -%>
proxy_buffer_size <%= @proxy_buffer_size %>;
<% end -%>
<% if @proxy_busy_buffers_size -%>
proxy_busy_buffers_size <%= @proxy_busy_buffers_size %>;
<% end -%>
<% if @proxy_max_temp_file_size -%>
proxy_max_temp_file_size <%= @proxy_max_temp_file_size %>;
<% end -%>
<% if @proxy_http_version -%>
proxy_http_version <%= @proxy_http_version %>;
<% end -%>
Expand Down
6 changes: 6 additions & 0 deletions templates/server/locations/proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
<% if @proxy_buffering -%>
proxy_buffering <%= @proxy_buffering %>;
<% end -%>
<% if @proxy_busy_buffers_size -%>
proxy_busy_buffers_size <%= @proxy_busy_buffers_size %>;
<% end -%>
<% if @proxy_max_temp_file_size -%>
proxy_max_temp_file_size <%= @proxy_max_temp_file_size %>;
<% end -%>
<% unless @proxy_set_header.nil? -%>
<%- @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
Expand Down

0 comments on commit f30a773

Please sign in to comment.