X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ftemplates%2Fapache-www.debian.org.erb;h=e1759dbb2bd6d26224ed8e39f9366d1843db00f9;hb=56c943e4c7ff84a893ddf47efb2af3ad8977cff9;hp=d221e0cc8e48e771bfb46c258cb904ec9ebec6ec;hpb=4d83a8a15b82df8203d19a2d7d14cedf8e351c57;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/templates/apache-www.debian.org.erb b/modules/roles/templates/apache-www.debian.org.erb index d221e0cc8..e1759dbb2 100644 --- a/modules/roles/templates/apache-www.debian.org.erb +++ b/modules/roles/templates/apache-www.debian.org.erb @@ -130,6 +130,26 @@ # 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 @@ -145,7 +165,6 @@ # 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