diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index c2e446ed..c5d6ce0f 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -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 }, })) } diff --git a/releasenotes/notes/empty-root-url-495e1f1f47372f47.yaml b/releasenotes/notes/empty-root-url-495e1f1f47372f47.yaml new file mode 100644 index 00000000..dd23ecb5 --- /dev/null +++ b/releasenotes/notes/empty-root-url-495e1f1f47372f47.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Fixes wrong apache vhost config when root_url is empty diff --git a/spec/classes/horizon_wsgi_apache_spec.rb b/spec/classes/horizon_wsgi_apache_spec.rb index eb24dce0..d76c0879 100644 --- a/spec/classes/horizon_wsgi_apache_spec.rb +++ b/spec/classes/horizon_wsgi_apache_spec.rb @@ -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