Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the mod_proxy ProxyPassReverseCookiePath directive #1180

Merged
merged 1 commit into from
Sep 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2113,11 +2113,14 @@ apache::vhost { 'site.name.fdqn':
'keywords' => ['nocanon', 'interpolate'] },
{ '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_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.
`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

Expand Down
14 changes: 10 additions & 4 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@
'proxy_dest' => '/',
'proxy_pass' => [
{
'path' => '/a',
'url' => 'http://backend-a/',
'keywords' => ['noquery', 'interpolate'],
'params' => {
'path' => '/a',
'url' => 'http://backend-a/',
'keywords' => ['noquery', 'interpolate'],
'reverse_cookies' => [{
'path' => '/a',
'url' => 'http://backend-a/',
}],
'params' => {
'retry' => '0',
'timeout' => '5'
},
Expand Down Expand Up @@ -403,6 +407,8 @@
/SetEnv proxy-nokeepalive 1/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/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-rack') }
it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') }
it { is_expected.to contain_concat__fragment('rspec.example.com-rewrite') }
Expand Down
5 changes: 5 additions & 0 deletions templates/vhost/_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>
<%- end %>
<Location <%= proxy['path']%>>
<%- if not proxy['reverse_cookies'].nil? -%>
<%- Array(proxy['reverse_cookies']).each do |reverse_cookies| -%>
ProxyPassReverseCookiePath <%= reverse_cookies['path'] %> <%= reverse_cookies['url'] %>
<%- end -%>
<%- end -%>
<%- if proxy['reverse_urls'].nil? -%>
ProxyPassReverse <%= proxy['url'] %>
<%- else -%>
Expand Down