Avoid empty redirect rule in vhost config
When root_url is empty, an incorrect rewrite rule will be created at vhosts config file causing httpd failure. In order not to create any rule when root_url is empty, the value should be ignored inside redirectmatch parameter Change-Id: Idd4ac6a271b4c8d8e53ab27c68abd821a3aa0249 Closes-bug: #1665380
This commit is contained in:
parent
7545989c46
commit
003d69f69c
@ -236,8 +236,8 @@ class horizon::wsgi::apache (
|
||||
}
|
||||
|
||||
ensure_resource('apache::vhost', $vhost_conf_name, merge ($default_vhost_conf, $extra_params, {
|
||||
redirectmatch_regexp => $root_url ? { '/' => undef, default => $redirect_match },
|
||||
redirectmatch_dest => $root_url ? { '/' => undef, default => $redirect_url },
|
||||
redirectmatch_regexp => $root_url ? { '' => undef, '/' => undef, default => $redirect_match },
|
||||
redirectmatch_dest => $root_url ? { '' => undef, '/' => undef, default => $redirect_url },
|
||||
}))
|
||||
ensure_resource('apache::vhost', $vhost_ssl_conf_name, merge ($default_vhost_conf, $extra_params, {
|
||||
access_log_file => 'horizon_ssl_access.log',
|
||||
@ -248,8 +248,8 @@ class horizon::wsgi::apache (
|
||||
ensure => $ensure_ssl_vhost,
|
||||
wsgi_daemon_process => 'horizon-ssl',
|
||||
wsgi_process_group => 'horizon-ssl',
|
||||
redirectmatch_regexp => $root_url ? { '/' => undef, default => '^/$' },
|
||||
redirectmatch_dest => $root_url ? { '/' => undef, default => $root_url },
|
||||
redirectmatch_regexp => $root_url ? { '' => undef, '/' => undef, default => '^/$' },
|
||||
redirectmatch_dest => $root_url ? { '' => undef, '/' => undef, default => $root_url },
|
||||
}))
|
||||
|
||||
}
|
||||
|
3
releasenotes/notes/empty-root-url-495e1f1f47372f47.yaml
Normal file
3
releasenotes/notes/empty-root-url-495e1f1f47372f47.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixes wrong apache vhost config when root_url is empty
|
@ -195,6 +195,24 @@ describe 'horizon::wsgi::apache' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with root_url set to empty' do
|
||||
before do
|
||||
params.merge!({
|
||||
:root_url => '',
|
||||
})
|
||||
end
|
||||
|
||||
it 'should not configure redirectmatch' do
|
||||
is_expected.to_not contain_apache__vhost('horizon_vhost').with(
|
||||
'redirectmatch_regexp' => '(.*)',
|
||||
'redirectmatch_dest' => '/'
|
||||
)
|
||||
is_expected.to_not contain_apache__vhost('horizon_ssl_vhost').with(
|
||||
'redirectmatch_regexp' => '^/$',
|
||||
'redirectmatch_dest' => ''
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user