fix syncproxy http -> https redirect on ipv6
[mirror/dsa-puppet.git] / modules / roles / templates / syncproxy / syncproxy.debian.org-apache.erb
index 5e4588b..de01c02 100644 (file)
@@ -4,12 +4,19 @@
 ##
 
 <%
-  vhost_listen = [ (bind != '') ? "#{bind}:80" : "*:80",  (bind6 != '') ? "#{bind6}:80" : "*:80"].uniq.join(' ')
-  vhost_listen_443 = [ (bind != '') ? "#{bind}:443" : "*:443",  (bind6 != '') ? "#{bind6}:443" : "*:443"].uniq.join(' ')
+  vhost_listen = [ (bind != '') ? "#{bind}" : "*",  (bind6 != '') ? "#{bind6}" : "*"].uniq
+  vhost_listen_443 = [ (bind != '') ? "#{bind}:443" : "*:443",  (bind6 != '') ? "[#{bind6}]:443" : "*:443"].uniq
 %>
 
-Use common-debian-service-https-redirect "<%= vhost_listen %>" <%= syncproxy_name %>
-<Virtualhost <%= vhost_listen_443 %> >
+<%=
+lines = []
+vhost_listen.each do |bind|
+   lines << "Use common-debian-service-https-redirect \"#{bind}\" \"#{syncproxy_name}\""
+end
+lines.join("\n")
+
+%>
+<Virtualhost <%= vhost_listen_443.join(' ') %> >
    ServerName <%= syncproxy_name %>
    DocumentRoot /srv/www/syncproxy.debian.org/htdocs
 
@@ -32,7 +39,6 @@ lines = []
     lines << "  Alias /#{archive}/project/trace/ /srv/mirrors/#{archive}/project/trace/"
     lines << "  <Directory /srv/mirrors/#{archive}/project/trace/>"
     lines << "    Require all granted"
-    lines << "    IndexOptions NameWidth=*"
     lines << "    Options +Indexes"
     lines << "  </Directory>"
   end