Merge pull request #170 from TelekomCloud/feature/set_proxy_method_and_body
Add support for proxy method and body
This commit is contained in:
commit
7c1674202a
4 changed files with 42 additions and 0 deletions
|
@ -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
|
||||
|
@ -111,6 +114,8 @@ define nginx::resource::location (
|
|||
$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
|
||||
|
|
|
@ -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
|
||||
|
@ -112,6 +115,8 @@ define nginx::resource::vhost (
|
|||
$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,
|
||||
|
@ -215,6 +220,8 @@ define nginx::resource::vhost (
|
|||
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,
|
||||
|
|
|
@ -65,6 +65,30 @@ describe 'nginx::resource::location' do
|
|||
: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',
|
||||
|
|
|
@ -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 -%>
|
||||
|
|
Loading…
Reference in a new issue