From 1b7ac9ab43aad33c2c292f389a74d66f6e7d0af6 Mon Sep 17 00:00:00 2001 From: John Bond Date: Wed, 2 Apr 2014 15:06:08 +0200 Subject: [PATCH] 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 --- manifests/resource/location.pp | 12 ++++++++++++ templates/vhost/vhost_location_proxy.erb | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 43a803083..7989f5050 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -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 @@ '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 @@ 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) } diff --git a/templates/vhost/vhost_location_proxy.erb b/templates/vhost/vhost_location_proxy.erb index 6b8acc2db..fbc7765c8 100644 --- a/templates/vhost/vhost_location_proxy.erb +++ b/templates/vhost/vhost_location_proxy.erb @@ -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 -%>