diff --git a/README.md b/README.md index 57ba525bfa..bd879ed59f 100644 --- a/README.md +++ b/README.md @@ -2260,13 +2260,13 @@ apache::vhost { 'site.name.fdqn': { 'path' => '/f', 'url' => 'http://backend-f/', 'setenv' => ['proxy-nokeepalive 1','force-proxy-request-1.0 1']}, { 'path' => '/g', 'url' => 'http://backend-g/', - 'reverse_cookies' => [{'path' => '/g', 'url' => 'http://backend-g/',}], }, + 'reverse_cookies' => [{'path' => '/g', 'url' => 'http://backend-g/',}, {'domain' => 'http://backend-g', 'url' => 'http:://backend-g',},], }, ], } ~~~ `reverse_urls` is optional and can be an array or a string. It is useful when used with `mod_proxy_balancer`. -`reverse_cookies` is optional and is used to set ProxyPassReverseCookiePath. +`reverse_cookies` is optional and is used to set ProxyPassReverseCookiePath and/or ProxyPassReverseCookieDomain. `params` is an optional parameter. It allows to provide the ProxyPass key=value parameters (Connection settings). `setenv` is optional and is an array to set environment variables for the proxy directive, for details see http://httpd.apache.org/docs/current/mod/mod_proxy.html#envsettings diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 9dd563a9c6..0096e06029 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -219,10 +219,16 @@ 'path' => '/a', 'url' => 'http://backend-a/', 'keywords' => ['noquery', 'interpolate'], - 'reverse_cookies' => [{ - 'path' => '/a', - 'url' => 'http://backend-a/', - }], + 'reverse_cookies' => [ + { + 'path' => '/a', + 'url' => 'http://backend-a/', + }, + { + 'domain' => 'foo', + 'url' => 'http://foo', + } + ], 'params' => { 'retry' => '0', 'timeout' => '5' @@ -425,6 +431,8 @@ /noquery interpolate/) } it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content( /ProxyPassReverseCookiePath\s+\/a\s+http:\/\//) } + it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content( + /ProxyPassReverseCookieDomain\s+foo\s+http:\/\/foo/) } it { is_expected.to contain_concat__fragment('rspec.example.com-rack') } it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } it { is_expected.to contain_concat__fragment('rspec.example.com-rewrite') } diff --git a/templates/vhost/_proxy.erb b/templates/vhost/_proxy.erb index 3f94af9112..9e9c05170f 100644 --- a/templates/vhost/_proxy.erb +++ b/templates/vhost/_proxy.erb @@ -20,7 +20,12 @@ > <%- if not proxy['reverse_cookies'].nil? -%> <%- Array(proxy['reverse_cookies']).each do |reverse_cookies| -%> - ProxyPassReverseCookiePath <%= reverse_cookies['path'] %> <%= reverse_cookies['url'] %> + <%- if reverse_cookies['path'] -%> + ProxyPassReverseCookiePath <%= reverse_cookies['path'] %> <%= reverse_cookies['url'] %> + <%- end -%> + <%- if reverse_cookies['domain'] -%> + ProxyPassReverseCookieDomain <%= reverse_cookies['domain'] %> <%= reverse_cookies['url'] %> + <%- end -%> <%- end -%> <%- end -%> <%- if proxy['reverse_urls'].nil? -%>