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