Adding ability to add proxy_cache_use_stale and proxy_cache_key within a location resource
Adding spec tests for proxy_cache_key and proxy_cache_use_stale
This commit is contained in:
parent
24d8d4d5c5
commit
4d93e049ca
4 changed files with 45 additions and 1 deletions
|
@ -70,6 +70,10 @@
|
|||
# [*option*] - Reserved for future use
|
||||
# [*proxy_cache*] - This directive sets name of zone for caching.
|
||||
# The same zone can be used in multiple places.
|
||||
# [*proxy_cache_key*] - Override the default proxy_cache_key of
|
||||
# $scheme$proxy_host$request_uri
|
||||
# [*proxy_cache_use_stale*] - Override the default proxy_cache_use_stale value
|
||||
# of off.
|
||||
# [*proxy_cache_valid*] - This directive sets the time for caching
|
||||
# different replies.
|
||||
# [*proxy_method*] - If defined, overrides the HTTP method of the
|
||||
|
@ -166,6 +170,8 @@ define nginx::resource::location (
|
|||
$include = undef,
|
||||
$try_files = undef,
|
||||
$proxy_cache = false,
|
||||
$proxy_cache_key = undef,
|
||||
$proxy_cache_use_stale = undef,
|
||||
$proxy_cache_valid = false,
|
||||
$proxy_method = undef,
|
||||
$proxy_set_body = undef,
|
||||
|
@ -277,6 +283,12 @@ define nginx::resource::location (
|
|||
if ($proxy_cache != false) {
|
||||
validate_string($proxy_cache)
|
||||
}
|
||||
if ($proxy_cache_key != undef) {
|
||||
validate_string($proxy_cache_key)
|
||||
}
|
||||
if ($proxy_cache_use_stale != undef) {
|
||||
validate_string($proxy_cache_use_stale)
|
||||
}
|
||||
if ($proxy_cache_valid != false) {
|
||||
validate_string($proxy_cache_valid)
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@
|
|||
# checked as an array. Cannot be used in conjuction with $proxy.
|
||||
# [*proxy_cache*] - This directive sets name of zone for caching.
|
||||
# The same zone can be used in multiple places.
|
||||
# [*proxy_cache_key*] - Override the default proxy_cache_key of
|
||||
# $scheme$proxy_host$request_uri
|
||||
# [*proxy_cache_use_stale*] - Override the default proxy_cache_use_stale value
|
||||
# of off.
|
||||
# [*proxy_cache_valid*] - This directive sets the time for caching
|
||||
# different replies.
|
||||
# [*proxy_method*] - If defined, overrides the HTTP method of the
|
||||
|
@ -193,6 +197,8 @@ define nginx::resource::vhost (
|
|||
$proxy_connect_timeout = $::nginx::config::proxy_connect_timeout,
|
||||
$proxy_set_header = [],
|
||||
$proxy_cache = false,
|
||||
$proxy_cache_key = undef,
|
||||
$proxy_cache_use_stale = undef,
|
||||
$proxy_cache_valid = false,
|
||||
$proxy_method = undef,
|
||||
$proxy_set_body = undef,
|
||||
|
@ -322,6 +328,12 @@ define nginx::resource::vhost (
|
|||
if ($proxy_cache != false) {
|
||||
validate_string($proxy_cache)
|
||||
}
|
||||
if ($proxy_cache_key != undef) {
|
||||
validate_string($proxy_cache_key)
|
||||
}
|
||||
if ($proxy_cache_use_stale != undef) {
|
||||
validate_string($proxy_cache_use_stale)
|
||||
}
|
||||
if ($proxy_cache_valid != false) {
|
||||
validate_string($proxy_cache_valid)
|
||||
}
|
||||
|
@ -530,6 +542,8 @@ define nginx::resource::vhost (
|
|||
proxy_read_timeout => $proxy_read_timeout,
|
||||
proxy_connect_timeout => $proxy_connect_timeout,
|
||||
proxy_cache => $proxy_cache,
|
||||
proxy_cache_key => $proxy_cache_key,
|
||||
proxy_cache_use_stale => $proxy_cache_use_stale,
|
||||
proxy_cache_valid => $proxy_cache_valid,
|
||||
proxy_method => $proxy_method,
|
||||
proxy_set_header => $proxy_set_header,
|
||||
|
|
|
@ -604,7 +604,19 @@ describe 'nginx::resource::location' do
|
|||
:value => false,
|
||||
:notmatch => /proxy_cache\b/
|
||||
},
|
||||
{
|
||||
{
|
||||
:title => 'should set proxy_cache_key',
|
||||
:attr => 'proxy_cache_key',
|
||||
:value => 'value',
|
||||
:match => /^\s+proxy_cache_key\s+value;/,
|
||||
},
|
||||
{
|
||||
:title => 'should set proxy_cache_use_stale',
|
||||
:attr => 'proxy_cache_use_stale',
|
||||
:value => 'value',
|
||||
:match => /^\s+proxy_cache_use_stale\s+value;/
|
||||
},
|
||||
{
|
||||
:title => 'should set proxy_pass',
|
||||
:attr => 'proxy',
|
||||
:value => 'value',
|
||||
|
|
|
@ -21,3 +21,9 @@
|
|||
<% if @proxy_cache_valid -%>
|
||||
proxy_cache_valid <%= @proxy_cache_valid %>;
|
||||
<% end -%>
|
||||
<% if @proxy_cache_use_stale -%>
|
||||
proxy_cache_use_stale <%= @proxy_cache_use_stale %>;
|
||||
<% end -%>
|
||||
<% if @proxy_cache_key -%>
|
||||
proxy_cache_key <%= @proxy_cache_key %>;
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue