changeset 155:e661cb2dd942 puppet-3.6

Make sure that we still redirect to non-www if we want it
author IBBoard <dev@ibboard.co.uk>
date Tue, 28 Mar 2017 21:05:12 +0100
parents 3c978b965881
children 9cf4ebd6d2ba
files modules/website/manifests/https.pp modules/website/templates/https_core_conf.erb
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/website/manifests/https.pp	Tue Mar 28 20:56:53 2017 +0100
+++ b/modules/website/manifests/https.pp	Tue Mar 28 21:05:12 2017 +0100
@@ -29,6 +29,11 @@
   $shortname = domain_to_short_name($name)
   $logpart = $shortname
   $shortdomain = domain_to_short_domain($name)
+  if $force_no_www {
+    $primary_name = $shortdomain
+  } else {
+    $primary_name = $name
+  }
 
   $custom_conf0 = template('website/https_core_conf.erb')
 
--- a/modules/website/templates/https_core_conf.erb	Tue Mar 28 20:56:53 2017 +0100
+++ b/modules/website/templates/https_core_conf.erb	Tue Mar 28 21:05:12 2017 +0100
@@ -3,5 +3,5 @@
 Header always set X-Content-Type-Options "nosniff"
 Header always set X-Frame-Options "SAMEORIGIN"
 
-RewriteCond %{HTTP_HOST} !=<%= @name %>
-RewriteRule ^(.*)$ https://<%= @name %>/$1 [R=301,L]
+RewriteCond %{HTTP_HOST} !=<%= @primary_name %>
+RewriteRule ^(.*)$ https://<%= @primary_name %>/$1 [R=301,L]