summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/init.pp7
-rw-r--r--templates/site.erb3
2 files changed, 9 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 205b11f..ee8dc3a 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -91,6 +91,11 @@ class apache {
require => Package["apache"],
}
+ module { "rewrite":
+ ensure => present,
+ require => Package["apache"],
+ }
+
# apache mod_macro configuration
file { "${apache2_macros}":
ensure => present,
@@ -147,7 +152,7 @@ class apache {
$mpm = true, $mpm_user = '', $mpm_group = '', $password = '*',
$comment = '', $sshkey = absent,
$groups = '', $shell = '/bin/false', $manage_user = true,
- $ssl = false, $listen = '*') {
+ $ssl = false, $listen = '*', $https_redirect = false) {
$vhost = $filename ? {
'' => "$title",
diff --git a/templates/site.erb b/templates/site.erb
index be92907..f02dbe0 100644
--- a/templates/site.erb
+++ b/templates/site.erb
@@ -3,6 +3,9 @@
ServerName <%= title %>.<%= hosting_domain %>
<% if server_alias != false %> ServerAlias <%= server_alias %><% end %>
DocumentRoot <%= docroot %>
+ <% if https_redirect != false %>
+ RewriteEngine On
+ RewriteRule (.*) https://<%= title %>.<%= hosting_domain %>$1<% end %>
<% if redirect_match != false %> RedirectMatch ^/$ <%= protocol %>://<%= title %>.<%= hosting_domain %>/<%= redirect_match %><% end %>
<% if redirect != false %> Redirect <%= redirect %><% end %>
<% if aliases != false %><% aliases.each do |map| -%>