From f43d0869c763c84f655405a08c829e1c9c1c2655 Mon Sep 17 00:00:00 2001 From: Ivan Chavero Date: Fri, 28 Mar 2014 00:15:29 -0700 Subject: [PATCH] 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 --- packstack/puppet/templates/horizon.pp | 6 ------ packstack/puppet/templates/https.pp | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packstack/puppet/templates/horizon.pp b/packstack/puppet/templates/horizon.pp index 2be86e8f1..499ff5d44 100644 --- a/packstack/puppet/templates/horizon.pp +++ b/packstack/puppet/templates/horizon.pp @@ -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', diff --git a/packstack/puppet/templates/https.pp b/packstack/puppet/templates/https.pp index 171eae27d..e90c85c16 100644 --- a/packstack/puppet/templates/https.pp +++ b/packstack/puppet/templates/https.pp @@ -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\n\tServerName %(CONFIG_HORIZON_HOST)s\n\tRedirect / https://%(CONFIG_HORIZON_HOST)s:${https_port}/\n\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