remove double slashes on metadata.ftp-master.debian.org
[mirror/dsa-puppet.git] / modules / roles / templates / static-mirroring / vhost / static-vhosts-simple.erb
1 # puppet maintained
2
3 ######################
4 # deb.debian.org
5 <% if scope.function_has_static_component(['deb.debian.org']) -%>
6 <Macro vstatic-vhost-extra-deb.debian.org>
7         Redirect /debian/           http://cdn-fastly.deb.debian.org/debian/
8         Redirect /debian-debug/     http://cdn-fastly.deb.debian.org/debian-debug/
9         Redirect /debian-ports/     http://cdn-fastly.deb.debian.org/debian-ports/
10         Redirect /debian-security/  http://cdn-fastly.deb.debian.org/debian-security/
11 </Macro>
12 <% end -%>
13
14 <Macro vstatic-vhost-extra-network-test.debian.org>
15         ServerAlias network-test-backend.debian.org
16 </Macro>
17
18 <Macro vstatic-vhost-extra-bits.debian.org>
19         <IfModule mod_geoip.c>
20                 CustomLog /var/log/apache2/bits.debian.org-public-access.log privacy+geo
21         </IfModule>
22 </Macro>
23
24 <Macro vstatic-vhost-extra-metadata.ftp-master.debian.org>
25         AddDefaultCharset utf-8
26
27         # Rewrite away double slashes
28         RewriteEngine on
29         RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ [NC]
30         RewriteRule . %1/%2 [R=301,L,NE]
31
32         <LocationMatch "/changelogs/(main|contrib|non-free)">
33                 ForceType text/plain
34         </LocationMatch>
35 </Macro>
36
37 <Macro vstatic-vhost-extra-release.debian.org>
38         RewriteEngine   on
39         RewriteRule             ^/migration/$                   /migration/testing.pl
40         RewriteRule             ^/migration/search/(.+)/$       /migration/testing.pl?package=$1
41         RewriteCond             %{QUERY_STRING} package=((.)(.*))
42         RewriteRule             ^/migration/testing.pl          /migration/cache/%2/%1.html [PT,L]
43         RewriteRule             ^/migration/testing.pl          /migration/cache/_index.html
44
45         Alias /proposed-updates/ /srv/static.debian.org/mirrors/release.debian.org-pu/cur/
46         <Directory /srv/static.debian.org/mirrors/release.debian.org-pu/cur>
47                 Require all granted
48                 Options Indexes SymLinksIfOwnerMatch MultiViews
49                 IndexOptions FancyIndexing NameWidth=*
50
51                 AddEncoding gzip .gz
52                 FilterDeclare gzip CONTENT_SET
53                 FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip/"
54                 FilterChain gzip
55                 <Files *.debdiff.gz>
56                         ForceType text/plain
57                         AddDefaultCharset utf-8
58                 </Files>
59         </Directory>
60 </Macro>
61
62 <Macro vstatic-vhost-extra-www.ports.debian.org>
63         <Directory /srv/static.debian.org/mirrors/www.ports.debian.org/cur>
64                 AllowOverride FileInfo Indexes Options=Multiviews
65                 Options Multiviews Indexes FollowSymLinks Includes
66                 IndexOptions FancyIndexing NameWidth=*
67                 Require all granted
68         </Directory>
69
70         AddOutputFilter INCLUDES .xhtml
71 </Macro>
72
73
74 <Macro vstatic-vhost-extra-lintian.debian.org>
75         AddDefaultCharset utf-8
76
77         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur>
78                 Require all granted
79
80                 # These three lines makes apache serve
81                 # "lintian.log.gz" as a text/plain with encoding gzip
82                 # making it easier to view the log in the browser.
83                 RemoveType .gz
84                 AddEncoding x-gzip .gz
85                 AddType text/plain .log
86
87                 <IfModule mod_userdir.c>
88                         AddOutputFilterByType DEFLATE image/svg+xml
89                         AddOutputFilterByType DEFLATE text/plain
90                 </IfModule>
91         </Directory>
92
93         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur/resources>
94                 # Cache these for a year (3600 * 24 * 365.25)
95                 # Files in here will change name if their content change
96                 Header set Cache-Control "max-age=31557600, public"
97         </Directory>
98
99         RewriteEngine on
100         RewriteMap source-map txt:/srv/static.debian.org/mirrors/lintian.debian.org/cur/lookup-tables/source-packages
101
102         # Re-direct from the "old" locations to the new ones
103         RewriteRule ^/reports/T(.*)\.html$ /tags/$1.html [L,R=permanent]
104         RewriteRule ^/reports/(.*)$ /$1 [L,R=permanent]
105
106         # Map source packages to reports (this mapping is re-written once per lintian run,
107         # serve it as a 302 rather than a permanent redirect)
108         # Version-less request
109         RewriteRule ^/source/([a-z0-9-]+)/?$ /${source-map:$1} [L,R,NE]
110         # Versioned request
111         RewriteRule ^/source/([a-z0-9-]+)/([a-zA-Z0-9.+:~-]+)$ /${source-map:$1/$2} [L,R,NE]
112 </Macro>
113
114 <%=
115
116 def vhost(lines, sn, kwargs={})
117         if scope.function_has_static_component([sn])
118                 if not kwargs[:extra]
119                                 lines << "<Macro vstatic-vhost-extra-#{sn}>"
120                                 lines << "  # mod macro does not like empty macros, so here's some content:"
121                                 lines << "  <Directory /non-existant>"
122                                 lines << "  </Directory>"
123                                 lines << "</Macro>"
124                 end
125
126                 lines << "Use prepare-static-vhost #{sn}"
127
128                 if kwargs[:ssl] and kwargs[:ssl_optional]
129                         lines << "Use static-vhost-plain-#{sn}"
130                         lines << "Use static-vhost-ssl-#{sn}"
131                 elsif kwargs[:ssl]
132                         lines << "Use common-dsa-vhost-https-redirect #{sn}"
133                         lines << "Use static-vhost-ssl-#{sn}"
134                 else
135                         lines << "Use static-vhost-plain-#{sn}"
136                 end
137
138                 onion = scope.function_onion_global_service_hostname([sn])
139                 lines << "Use static-vhost-onion-#{sn} #{onion}" if onion
140
141                 lines << ""
142         end
143 end
144
145 lines = []
146 vhost(lines, "mozilla.debian.net"            , :ssl => true, :ssl_optional => true)
147 vhost(lines, "backports.debian.org"          , :ssl => true)
148 vhost(lines, "incoming.debian.org"           , :ssl => true, :ssl_optional => true)
149 vhost(lines, "incoming.ports.debian.org"     , :ssl => true, :ssl_optional => true)
150 vhost(lines, "debdeltas.debian.net"          , :ssl => true, :ssl_optional => true)
151 vhost(lines, "news.debian.net"               , :ssl => true)
152 vhost(lines, "bootstrap.debian.net"          , :ssl => true)
153 vhost(lines, "debaday.debian.net"            , :ssl => true)
154 vhost(lines, "timeline.debian.net"           , :ssl => true)
155 vhost(lines, "network-test.debian.org"       , :extra => true)
156 vhost(lines, "blends.debian.org"             , :ssl => true)
157 vhost(lines, "wnpp-by-tags.debian.net"       , :ssl => true)
158 vhost(lines, "security-team.debian.org"      , :ssl => true)
159 vhost(lines, "d-i.debian.org"                , :ssl => true)
160 vhost(lines, "appstream.debian.org"          , :ssl => true)
161 vhost(lines, "dsa.debian.org"                , :ssl => true)
162 vhost(lines, "rtc.debian.org"                , :ssl => true)
163 vhost(lines, "onion.debian.org"              , :ssl => true)
164
165 vhost(lines, "bits.debian.org"               , :ssl => true, :extra => true)
166 vhost(lines, "micronews.debian.org"          , :ssl => true)
167 vhost(lines, "metadata.ftp-master.debian.org", :extra => true)
168
169 vhost(lines, "10years.debconf.org"           , :ssl => true)
170 vhost(lines, "debconf0.debconf.org"          , :ssl => true)
171 vhost(lines, "debconf1.debconf.org"          , :ssl => true)
172 vhost(lines, "debconf2.debconf.org"          , :ssl => true)
173 vhost(lines, "debconf3.debconf.org"          , :ssl => true)
174 vhost(lines, "debconf4.debconf.org"          , :ssl => true)
175 vhost(lines, "debconf5.debconf.org"          , :ssl => true)
176 vhost(lines, "debconf6.debconf.org"          , :ssl => true)
177 vhost(lines, "debconf7.debconf.org"          , :ssl => true)
178 vhost(lines, "debconf16.debconf.org"         , :ssl => true)
179 vhost(lines, "es.debconf.org"                , :ssl => true)
180 vhost(lines, "fr.debconf.org"                , :ssl => true)
181 vhost(lines, "miniconf10.debconf.org"        , :ssl => true)
182
183 vhost(lines, "deb.debian.org"                , :extra => true)
184 vhost(lines, "release.debian.org"            , :ssl => true, :extra => true)
185 vhost(lines, "www.ports.debian.org"          , :ssl => true, :extra => true)
186 vhost(lines, "lintian.debian.org"            , :ssl => true, :extra => true)
187
188 lines.join("\n")
189 -%>
190
191 # www.backports.org
192 ###################
193 # www.backports.org is the historical place for the backports
194 # website and archive.  It is now a CNAME to backports.debian.org:
195 # redirect http requests.
196 <VirtualHost <%= vhost_listen %> >
197         ServerName www.backports.org
198         ServerAlias lists.backports.org
199         ServerAdmin debian-admin@debian.org
200         RedirectPermanent / http://backports.debian.org/
201 </VirtualHost>
202
203 ######################
204 <VirtualHost <%= vhost_listen %> >
205         ServerName www.debian-ports.org
206         ServerAlias debian-ports.org
207         ServerAdmin debian-admin@debian.org
208         RedirectPermanent / https://www.ports.debian.org/
209 </VirtualHost>
210
211 <VirtualHost <%= vhost_listen %> >
212         ServerName ports.debian.org
213         ServerAlias ports.debian.net
214         ServerAdmin debian-admin@debian.org
215         RedirectPermanent / https://www.ports.debian.org/
216 </VirtualHost>
217
218 <VirtualHost <%= vhost_listen %> >
219         ServerName incoming.debian-ports.org
220         ServerAdmin debian-admin@debian.org
221         RedirectPermanent / http://incoming.ports.debian.org/
222 </VirtualHost>
223
224 <VirtualHost <%= vhost_listen %> >
225         ServerName ftp.debian-ports.org
226         ServerAdmin debian-admin@debian.org
227         RedirectPermanent /archive http://www.ports.debian.org
228         RedirectPermanent /debian http://ftp.ports.debian.org/debian-ports
229         RedirectPermanent /debian-cd http://ftp.ports.debian.org/debian-ports-cd
230         RedirectPermanent / http://ftp.ports.debian.org/
231 </VirtualHost>
232
233 <VirtualHost <%= vhost_listen %> >
234         ServerName video.debian.net
235         ServerAdmin debian-admin@debian.org
236         Redirect / http://meetings-archive.debian.net/pub/debian-meetings/
237 </VirtualHost>
238
239 # historical sites
240 ##################
241 # now only redirects remain
242 <VirtualHost <%= vhost_listen %> >
243         ServerName women.debian.org
244         ServerAdmin debian-admin@debian.org
245
246         RedirectPermanent / http://www.debian.org/women/
247
248         RedirectPermanent /about/ http://www.debian.org/women/about
249         RedirectPermanent /contact/ http://www.debian.org/women/contact
250         RedirectPermanent /faqs/ http://www.debian.org/women/faq
251         RedirectPermanent /home/ http://www.debian.org/women/
252         RedirectPermanent /images/dw.png http://www.debian.org/women/dw.png
253         RedirectPermanent /involvement/ http://www.debian.org/women/participate
254         RedirectPermanent /mentoring/ http://www.debian.org/women/mentoring
255         RedirectPermanent /press/ http://wiki.debian.org/DebianWomen/Press
256         RedirectPermanent /profiles/ http://www.debian.org/women/profiles/
257 </VirtualHost>
258
259 <VirtualHost <%= vhost_listen %> >
260         ServerName volatile.debian.org
261         ServerAlias volatile-master.debian.org
262         ServerAdmin debian-admin@debian.org
263         RedirectPermanent / http://www.debian.org/volatile/
264 </VirtualHost>
265
266 <VirtualHost <%= vhost_listen %> >
267         ServerName ftp-master.metadata.debian.org
268         ServerAdmin debian-admin@debian.org
269         RedirectPermanent / http://metadata.ftp-master.debian.org/
270 </VirtualHost>
271
272 # vim:ft=apache: