Skip to content

Commit 44b0f0f

Browse files
author
Morgan Haskel
committed
Merge pull request #1145 from jonnytpuppet/fix_vhost_proxy
Fix test condition for proxy directives.
2 parents e267668 + 4da8f49 commit 44b0f0f

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

manifests/vhost.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@
628628
# - $proxy_pass_match
629629
# - $proxy_preserve_host
630630
# - $no_proxy_uris
631-
if $proxy_dest or $proxy_pass or $proxy_pass_match {
631+
if $proxy_dest or $proxy_pass or $proxy_pass_match or $proxy_dest_match {
632632
concat::fragment { "${name}-proxy":
633633
target => "${priority_real}${filename}.conf",
634634
order => 140,

spec/defines/vhost_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,30 @@
414414
it { is_expected.to contain_concat__fragment('rspec.example.com-charsets') }
415415
it { is_expected.to contain_concat__fragment('rspec.example.com-file_footer') }
416416
end
417+
context 'proxy_pass_match' do
418+
let :params do
419+
{
420+
'docroot' => '/rspec/docroot',
421+
'proxy_pass_match' => [
422+
{
423+
'path' => '.*',
424+
'url' => 'http://backend-a/',
425+
}
426+
],
427+
}
428+
end
429+
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
430+
/ProxyPassMatch .* http:\/\/backend-a\//).with_content(/## Proxy rules/) }
431+
end
432+
context 'proxy_dest_match' do
433+
let :params do
434+
{
435+
'docroot' => '/rspec/docroot',
436+
'proxy_dest_match' => '/'
437+
}
438+
end
439+
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(/## Proxy rules/) }
440+
end
417441
context 'not everything can be set together...' do
418442
let :params do
419443
{

templates/vhost/_proxy.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<% if @proxy_dest or @proxy_pass -%>
1+
<% if @proxy_dest or @proxy_pass or @proxy_pass_match or @proxy_dest_match -%>
22

33
## Proxy rules
44
ProxyRequests Off

0 commit comments

Comments
 (0)