Redirect to https port when SSL enabled

If SSL is enabled redirect to the https port
if horizon is accessed via port 80

Deleted the /etc/httpd/conf.d/rootredirect.conf
file statement because the horizon module already adds
those lines to /etc/httpd/conf.d/openstack-dashboard.conf

Change-Id: I5942b5bc4cf9a05b20101cfb9ef2da8461e96522
Fixes: rhbz#1078130
This commit is contained in:
Ivan Chavero
2014-03-28 00:15:29 -07:00
parent d7a5019e1e
commit f43d0869c7
2 changed files with 15 additions and 6 deletions

View File

@@ -7,12 +7,6 @@ package {$horizon_packages:
ensure => present,
}
file {"/etc/httpd/conf.d/rootredirect.conf":
ensure => present,
content => 'RedirectMatch ^/$ /dashboard/',
notify => File["/etc/httpd/conf.d/openstack-dashboard.conf"],
}
class {'horizon':
secret_key => '%(CONFIG_HORIZON_SECRET_KEY)s',
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',

View File

@@ -29,6 +29,21 @@ file_line{'nohttp_ip':
require => Class['horizon']
}
$https_port = %(CONFIG_HORIZON_PORT)s
file{'/etc/httpd/conf.d/openstack-dashboard-vhost-port-80.conf':
ensure => present,
content => "\n<VirtualHost *:80>\n\tServerName %(CONFIG_HORIZON_HOST)s\n\tRedirect / https://%(CONFIG_HORIZON_HOST)s:${https_port}/\n</VirtualHost>\n",
}
file_line{'redirect':
path => '/etc/httpd/conf.d/openstack-dashboard.conf',
match => '^RedirectMatch .*',
line => "RedirectMatch permanent ^/$ https://%(CONFIG_HORIZON_HOST)s:${https_port}/dashboard",
require => Class['horizon']
}
# if the mod_ssl apache puppet module does not install
# this file, we ensure it haves the minimum
# requirements for SSL to work