summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--templates/vhosts/default.erb11
1 files changed, 9 insertions, 2 deletions
diff --git a/templates/vhosts/default.erb b/templates/vhosts/default.erb
index 4a7d7f4..172518c 100644
--- a/templates/vhosts/default.erb
+++ b/templates/vhosts/default.erb
@@ -1,4 +1,11 @@
-<%- [:normal,:ssl].each do |vhost_part|
+<%-
+vhost_parts = case ssl_mode
+ when 'only' then [:ssl]
+ when false then [:normal]
+ when 'false' then [:normal]
+ else [:normal,:ssl]
+end
+vhost_parts.each do |vhost_part|
# we need this variable in included templates
@vhost_part = vhost_part
%>
@@ -7,7 +14,7 @@
<%= scope.function_template('apache/vhosts/partials/header_default.erb') %>
<%= scope.function_template('apache/vhosts/partials/logs.erb') %>
- <%- if ssl_mode == 'force' && vhost_part == :ssl %>
+ <%- if ssl_mode == 'force' && vhost_part == :normal %>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]