Skip to content

Commit ee1382e

Browse files
committed
add reset_timedout_connection parameter
1 parent d51a170 commit ee1382e

File tree

10 files changed

+41
-0
lines changed

10 files changed

+41
-0
lines changed

manifests/config.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
$lingering_timeout = $nginx::lingering_timeout
4444
$lingering_close = $nginx::lingering_close
4545
$lingering_time = $nginx::lingering_time
46+
$reset_timedout_connection = $nginx::reset_timedout_connection
4647
$etag = $nginx::etag
4748
$events_use = $nginx::events_use
4849
$debug_connections = $nginx::debug_connections

manifests/init.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
# @param service_config_check_command
3535
# Command to execute to validate the generated configuration.
3636
#
37+
# @param reset_timedout_connection
38+
# Enables or disables resetting timed out connections and connections closed
39+
# with the non-standard code 444.
40+
#
3741
class nginx (
3842
### START Nginx Configuration ###
3943
Variant[Stdlib::Absolutepath, Boolean] $client_body_temp_path = $nginx::params::client_body_temp_path,
@@ -175,6 +179,7 @@
175179
Optional[Stdlib::Absolutepath] $ssl_trusted_certificate = undef,
176180
Optional[Integer] $ssl_verify_depth = undef,
177181
Optional[Stdlib::Absolutepath] $ssl_password_file = undef,
182+
Optional[Enum['on', 'off']] $reset_timedout_connection = undef,
178183

179184
### START Package Configuration ###
180185
$package_ensure = present,

manifests/resource/location.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@
171171
# no longer inherit headers from the parent server context
172172
# @param gzip_static
173173
# Defines gzip_static, nginx default is off
174+
# @param reset_timedout_connection
175+
# Enables or disables resetting timed out connections and connections closed
176+
# with the non-standard code 444.
174177
#
175178
# @example Simple example
176179
# nginx::resource::location { 'test2.local-bob':
@@ -300,6 +303,7 @@
300303
Optional[String] $expires = undef,
301304
Hash $add_header = {},
302305
Optional[Enum['on', 'off', 'always']] $gzip_static = undef,
306+
Optional[Enum['on', 'off']] $reset_timedout_connection = undef,
303307
) {
304308
if ! defined(Class['nginx']) {
305309
fail('You must include the nginx base class before using any defined resources')

manifests/resource/server.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
# @param autoindex_localtime
4949
# Specifies whether times in the directory listing should be output in the
5050
# local time zone or UTC.
51+
# @param reset_timedout_connection
52+
# Enables or disables resetting timed out connections and connections closed
53+
# with the non-standard code 444.
5154
# @param proxy
5255
# Proxy server(s) for the root location to connect to. Accepts a single
5356
# value, can be used in conjunction with nginx::resource::upstream
@@ -362,6 +365,7 @@
362365
Optional[Enum['on', 'off']] $autoindex_exact_size = undef,
363366
Optional[Enum['html', 'xml', 'json', 'jsonp']] $autoindex_format = undef,
364367
Optional[Enum['on', 'off']] $autoindex_localtime = undef,
368+
Optional[Enum['on', 'off']] $reset_timedout_connection = undef,
365369
Array[String] $server_name = [$name],
366370
Optional[String] $www_root = undef,
367371
Boolean $rewrite_www_to_non_www = false,

spec/classes/nginx_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,12 @@
10961096
' debug_connection 127.0.0.1;',
10971097
' debug_connection unix:;'
10981098
]
1099+
},
1100+
{
1101+
title: 'should set reset_timedout_connection',
1102+
attr: 'reset_timedout_connection',
1103+
value: 'on',
1104+
match: %r{^\s+reset_timedout_connection\s+on;}
10991105
}
11001106
].each do |param|
11011107
context "when #{param[:attr]} is #{param[:value]}" do

spec/defines/resource_location_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@
230230
attr: 'auth_request',
231231
value: 'value',
232232
match: %r{\s+auth_request\s+value;}
233+
},
234+
{
235+
title: 'should set reset_timedout_connection',
236+
attr: 'reset_timedout_connection',
237+
value: 'on',
238+
match: %r{^\s+reset_timedout_connection\s+on;}
233239
}
234240
].each do |param|
235241
context "when #{param[:attr]} is #{param[:value]}" do

spec/defines/resource_server_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@
379379
attr: 'autoindex_exact_size',
380380
value: 'on',
381381
match: ' autoindex_exact_size on;'
382+
},
383+
{
384+
title: 'should set reset_timedout_connection',
385+
attr: 'reset_timedout_connection',
386+
value: 'on',
387+
match: %r{^\s+reset_timedout_connection\s+on;}
382388
}
383389
].each do |param|
384390
context "when #{param[:attr]} is #{param[:value]}" do

templates/conf.d/nginx.conf.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ http {
129129
<% end -%>
130130
lingering_timeout <%= @lingering_timeout %>;
131131
tcp_nodelay <%= @http_tcp_nodelay %>;
132+
<% if @reset_timedout_connection -%>
133+
reset_timedout_connection <%= @reset_timedout_connection %>;
134+
<% end -%>
132135

133136
<% if @etag -%>
134137
etag <%= @etag %>;

templates/server/location_header.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@
8080
<% if @limit_zone -%>
8181
limit_req zone=<%= @limit_zone %>;
8282
<% end -%>
83+
<% if @reset_timedout_connection -%>
84+
reset_timedout_connection <%= @reset_timedout_connection %>;
85+
<% end -%>

templates/server/server_header.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ server {
152152
<% if defined? @autoindex_localtime -%>
153153
autoindex_localtime <%= @autoindex_localtime %>;
154154
<% end -%>
155+
<% if @reset_timedout_connection -%>
156+
reset_timedout_connection <%= @reset_timedout_connection %>;
157+
<% end -%>
155158
<% if defined? @log_by_lua -%>
156159
log_by_lua '<%= @log_by_lua %>';
157160
<% end -%>

0 commit comments

Comments
 (0)