Add additional config to the locations section of config

Following parameters where added to the location resourse.  These
already existsed in the vhost resource so the same logic and defaults
where used
  * proxy_set_header
  * proxy_connect_timeout
  * proxy_redirect
This commit is contained in:
John Bond 2014-04-02 15:06:08 +02:00
parent 5e5f9d2ec7
commit 1b7ac9ab43
2 changed files with 17 additions and 0 deletions

View file

@ -20,8 +20,14 @@
# [*proxy*] - Proxy server(s) for a location to connect to.
# Accepts a single value, can be used in conjunction with
# nginx::resource::upstream
# [*proxy_redirect*] - sets the text, which must be changed in
# response-header "Location" and "Refresh" in the response of the proxied
# server.
# [*proxy_read_timeout*] - Override the default the proxy read timeout
# value of 90 seconds
# [*proxy_connect_timeout*] - Override the default the proxy connect timeout
# value of 90 seconds
# [*proxy_set_header*] - Array of vhost headers to set
# [*fastcgi*] - location of fastcgi (host:port)
# [*fastcgi_params*] - optional alternative fastcgi_params file to use
# [*fastcgi_script*] - optional SCRIPT_FILE parameter
@ -105,7 +111,10 @@ define nginx::resource::location (
'index.htm',
'index.php'],
$proxy = undef,
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$fastcgi = undef,
$fastcgi_params = '/etc/nginx/fastcgi_params',
$fastcgi_script = undef,
@ -155,7 +164,10 @@ define nginx::resource::location (
if ($proxy != undef) {
validate_string($proxy)
}
validate_string($proxy_redirect)
validate_string($proxy_read_timeout)
validate_string($proxy_connect_timeout)
validate_array($proxy_set_header)
if ($fastcgi != undef) {
validate_string($fastcgi)
}

View file

@ -33,6 +33,11 @@
<% end -%>
proxy_pass <%= @proxy %>;
proxy_read_timeout <%= @proxy_read_timeout %>;
proxy_connect_timeout <%= @proxy_connect_timeout %>;
proxy_redirect <%= @proxy_redirect %>;
<% @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
<% end -%>
<% if @proxy_method -%>
proxy_method <%= @proxy_method %>;
<% end -%>