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