Skip to content

Commit

Permalink
Merge pull request #1145 from jonnytpuppet/fix_vhost_proxy
Browse files Browse the repository at this point in the history
Fix test condition for proxy directives.
  • Loading branch information
Morgan Haskel committed Jun 22, 2015
2 parents e267668 + 4da8f49 commit 44b0f0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifests/vhost.pp
Expand Up @@ -628,7 +628,7 @@
# - $proxy_pass_match
# - $proxy_preserve_host
# - $no_proxy_uris
if $proxy_dest or $proxy_pass or $proxy_pass_match {
if $proxy_dest or $proxy_pass or $proxy_pass_match or $proxy_dest_match {
concat::fragment { "${name}-proxy":
target => "${priority_real}${filename}.conf",
order => 140,
Expand Down
24 changes: 24 additions & 0 deletions spec/defines/vhost_spec.rb
Expand Up @@ -414,6 +414,30 @@
it { is_expected.to contain_concat__fragment('rspec.example.com-charsets') }
it { is_expected.to contain_concat__fragment('rspec.example.com-file_footer') }
end
context 'proxy_pass_match' do
let :params do
{
'docroot' => '/rspec/docroot',
'proxy_pass_match' => [
{
'path' => '.*',
'url' => 'http://backend-a/',
}
],
}
end
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/ProxyPassMatch .* http:\/\/backend-a\//).with_content(/## Proxy rules/) }
end
context 'proxy_dest_match' do
let :params do
{
'docroot' => '/rspec/docroot',
'proxy_dest_match' => '/'
}
end
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(/## Proxy rules/) }
end
context 'not everything can be set together...' do
let :params do
{
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/_proxy.erb
@@ -1,4 +1,4 @@
<% if @proxy_dest or @proxy_pass -%>
<% if @proxy_dest or @proxy_pass or @proxy_pass_match or @proxy_dest_match -%>

## Proxy rules
ProxyRequests Off
Expand Down

0 comments on commit 44b0f0f

Please sign in to comment.