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