From 884a1c34326dec07b3f8e0a897d634096e4732de Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 10 Aug 2015 10:36:55 -0400 Subject: [PATCH] Rewrite trystack.org to trystack.o.o Add the required serveraliases and rewrite settings needed to support both trystack.openstack.org and trystack.org. Change-Id: I1a6560be8a1a24b50b1d047ed990e5f029ac5ee5 Signed-off-by: Paul Belanger --- modules/openstack_project/manifests/static.pp | 11 ++++++----- .../openstack_project/templates/trystack.vhost.erb | 11 +++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/openstack_project/manifests/static.pp b/modules/openstack_project/manifests/static.pp index 1abff6198f..896c86d991 100644 --- a/modules/openstack_project/manifests/static.pp +++ b/modules/openstack_project/manifests/static.pp @@ -233,11 +233,12 @@ class openstack_project::static ( # Trystack ::httpd::vhost { 'trystack.openstack.org': - port => 80, - priority => '50', - docroot => '/opt/trystack', - template => 'openstack_project/trystack.vhost.erb', - require => Vcsrepo['/opt/trystack'], + port => 80, + priority => '50', + docroot => '/opt/trystack', + template => 'openstack_project/trystack.vhost.erb', + serveraliases => ['trystack.org'], + require => Vcsrepo['/opt/trystack'], } vcsrepo { '/opt/trystack': diff --git a/modules/openstack_project/templates/trystack.vhost.erb b/modules/openstack_project/templates/trystack.vhost.erb index f9e09793f4..3af5caaa89 100644 --- a/modules/openstack_project/templates/trystack.vhost.erb +++ b/modules/openstack_project/templates/trystack.vhost.erb @@ -5,6 +5,16 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> :<%= @port %>> ServerName <%= @srvname %> +<% if @serveraliases.is_a? Array -%> +<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> +<% elsif @serveraliases != '' -%> +<%= " ServerAlias #{@serveraliases}" %> +<% end -%> + + # NOTE(pabelanger): Rewrite any valid serveraliases to srvname. + RewriteEngine On + RewriteCond %{HTTP_HOST} !<%= @srvname %>$ [NC] + RewriteRule ^/(.*)$ http://<%= @srvname %>/$1 [L,R=301] DocumentRoot <%= @docroot %> > @@ -12,6 +22,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> AllowOverride None Order allow,deny allow from all + Satisfy Any ErrorLog /var/log/apache2/<%= @name %>_error.log