Redirect http to https for planet
authorTom Hughes <tom@compton.nu>
Wed, 9 May 2018 07:22:11 +0000 (08:22 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 9 May 2018 07:22:11 +0000 (08:22 +0100)
cookbooks/planet/templates/default/apache.erb

index 8790c80..a8a761a 100644 (file)
@@ -1,21 +1,16 @@
 # DO NOT EDIT - This file is being maintained by Chef
-<% [80, 443].each do |port| -%>
    
-<VirtualHost *:<%= port %>>
+<VirtualHost *:443>
         ServerName planet.openstreetmap.org
         ServerAlias planet.osm.org
         ServerAdmin webmaster@openstreetmap.org
 
-<% if port == 443 -%>
+        CustomLog /var/log/apache2/planet.openstreetmap.org-access.log combined
+        ErrorLog /var/log/apache2/planet.openstreetmap.org-error.log
+
         SSLEngine on
         SSLCertificateFile /etc/ssl/certs/planet.openstreetmap.org.pem
         SSLCertificateKeyFile /etc/ssl/private/planet.openstreetmap.org.key
-<% else -%>
-        RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
-<% end -%>
-
-        CustomLog /var/log/apache2/planet.openstreetmap.org-access.log combined
-        ErrorLog /var/log/apache2/planet.openstreetmap.org-error.log
 
         DocumentRoot /store/planet
 
 
         RewriteRule     ^(/planet/planet\-latest\.osm\.bz2)$    ${latestplanet:$1}      [R,L]
 </VirtualHost>
-<% end -%>
+
+<VirtualHost *:80>
+        ServerName planet.openstreetmap.org
+        ServerAlias planet.osm.org
+        ServerAdmin webmaster@openstreetmap.org
+
+        CustomLog /var/log/apache2/planet.openstreetmap.org-access.log combined
+        ErrorLog /var/log/apache2/planet.openstreetmap.org-error.log
+
+        RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+        RedirectPermanent / https://planet.openstreetmap.org/
+</VirtualHost>