Import db.d.o apache vhost into puppet
[mirror/dsa-puppet.git] / modules / roles / templates / apache-www.debian.org.erb
index d221e0c..fac6e83 100644 (file)
    # this behavior, and proxies will be allowed to cache the documents.
    CacheNegotiatedDocs On
 
+   # The UI for language selection in browsers is rarely used or known about
+   # by visitors so websites need to provide a way for visitors to influence
+   # content negotiation using the website itself in addition to the browser.
+   # Setting a cookie is the simplest option for us as the URLs don't change.
+   # The GDPR does not apply and to satisfy the EU cookie law we can include
+   # some explanatory text around the form that sets the cookie.
+   # The use of POST requests will ensure each cookie is only set explictly.
+   # When a cookie is set by the user, update it on every visit so it doesn't
+   # expire unless the user stops visiting the website for the cookie duration.
+   # Since Apache mod_rewrite cannot inspect POST data, we use URLs instead.
+   RewriteEngine on
+   RewriteCond %{REQUEST_METHOD} ^POST$
+   RewriteRule /intro/cn/setlang/([a-z]{2}(?:-[a-z]{2})?)/(.*) /$2 [last,redirect,cookie=lang:$1:%{HTTP_HOST}:40320:/:secure:]
+   RewriteCond %{REQUEST_METHOD} ^POST$
+   RewriteRule /intro/cn/unsetlang/(.*) /$1 [last,redirect,cookie=lang:invalid:%{HTTP_HOST}:-1:/:secure:]
+   RewriteCond %{HTTP_COOKIE} /^lang=([a-z]{2}(?:-[a-z]{2})?)$/
+   RewriteRule . - [cookie=lang:%1:%{HTTP_HOST}:40320:/:secure:]
+   SetEnvIf Cookie "lang=(.+)" prefer-language=$1
+   Header append Vary cookie
+
 # Custom Error
    ErrorDocument 404 /devel/website/errors/404
    RewriteCond %{DOCUMENT_ROOT}/devel/website/errors/404.$2.html -f
 #   Redirect /OpenHardware http://www.openhardware.org
    Redirect /OpenSource https://opensource.org
    Redirect /Bugs/db/ix/pseudopackages.html /Bugs/pseudo-packages
-   RewriteEngine on
    RewriteRule ^/Bugs/db/pa/l([^/]+).html$ https://bugs.debian.org/$1
    RewriteRule ^/Bugs/db/[[:digit:]][[:digit:]]/([[:digit:]][[:digit:]][[:digit:]]+).html$ https://bugs.debian.org/$1
    RewriteRule ^/Bugs/db/ma/l([^/]+).html$ https://bugs.debian.org/cgi-bin/pkgreport.cgi?maintenc=$1
 
    RewriteRule ^/ports/freebsd(.*) /ports/kfreebsd-gnu/ [R]
    RewriteRule ^/devel/debian-installer/report-template(.*) /releases/stable/i386/ch05s04.html#submit-bug [NE,R]
-   RewriteRule ^/devel/debian-installer/hooks(.*) https://d-i.alioth.debian.org/doc/internals/apb.html [R]
+   RewriteRule ^/devel/debian-installer/hooks(.*) https://d-i.debian.org/doc/internals/apb.html [R]
    RewriteRule ^/doc/packaging-manuals/mime-policy(.*) /doc/debian-policy/ch-opersys.html#s-mime [NE,R]
 
    RewriteRule ^/volatile/index.* - [S=1]
    RewriteRule ^/doc/manuals/debian-reference/footnotes(.+)   /doc/manuals/debian-reference/index$1 [L,R]
    RewriteRule ^/doc/manuals/debian-reference/footnotes$      /doc/manuals/debian-reference/          [R]
 
-# DevRef filename changes c2016
-   RedirectMatch ^(/doc/manuals/developers-reference)/scope(\.[a-z]{2})?.html                 $1/ch01$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/new-maintainer(\.[a-z]{2})?.html        $1/ch02$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/developer-duties(\.[a-z]{2})?.html      $1/ch03$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/resources(\.[a-z]{2})?.html             $1/ch04$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/pkgs(\.[a-z]{2})?.html                  $1/ch05$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/best-pkging-practices(\.[a-z]{2})?.html $1/ch06$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/beyond-pkging(\.[a-z]{2})?.html         $1/ch07$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/l10n(\.[a-z]{2})?.html                  $1/ch08$2.html
-   RedirectMatch ^(/doc/manuals/developers-reference)/tools(\.[a-z]{2})?.html                 $1/apa$2.html
+# DevRef filename changes c2019 (#931548, migration to Sphinx)
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch01(\.[a-z]{2})?.html $1/scope$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch02(\.[a-z]{2})?.html $1/new-maintainer$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch03(\.[a-z]{2})?.html $1/developer-duties$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch04(\.[a-z]{2})?.html $1/resources$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch05(\.[a-z]{2})?.html $1/pkgs$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch06(\.[a-z]{2})?.html $1/best-pkging-practices$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch07(\.[a-z]{2})?.html $1/beyond-pkging$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/ch08(\.[a-z]{2})?.html $1/l10n$2.html
+   RedirectMatch ^(/doc/manuals/developers-reference)/apa(\.[a-z]{2})?.html  $1/tools$2.html
 
 # New Maintainers' Guide
    RewriteRule ^/doc/(manuals/)?maint-guide/ch-(.*) /doc/manuals/maint-guide/$2 [R]