]> gitweb.fluxo.info Git - puppet-apache.git/commitdiff
HSTS support
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 5 Dec 2011 20:34:28 +0000 (18:34 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 5 Dec 2011 20:34:28 +0000 (18:34 -0200)
templates/site.erb

index 25dd22d7da2b2efb981a0a842bdfe00c0f2b3255..246e6168a1080fb09e778d3d392071e6c473df97 100644 (file)
@@ -4,8 +4,12 @@
 <% if server_alias != false %>   ServerAlias <%= server_alias %><% end %>
    DocumentRoot <%= docroot %>
  <% if https_redirect != false %>
+    # Use HTTP Strict Transport Security to force client to use secure connections only
+    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"
+
+    # Redirect all HTTP to HTTPS
     RewriteEngine On
-    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
+    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
 <% 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| -%>