From: Paul Wise Date: Sun, 25 Aug 2019 03:48:59 +0000 (+0800) Subject: Bump the language cookie expiry for visits during the expiry period X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=40f4c26555c219deb326e43daabd07c13d90a7cb;p=mirror%2Fdsa-puppet.git Bump the language cookie expiry for visits during the expiry period This ensures that if the user continues to visit the website then they don't have to manually set the cookie again until they stop visiting the website for more than the expiry period. --- diff --git a/modules/roles/templates/apache-www.debian.org.erb b/modules/roles/templates/apache-www.debian.org.erb index 2253aa7d2..e1759dbb2 100644 --- a/modules/roles/templates/apache-www.debian.org.erb +++ b/modules/roles/templates/apache-www.debian.org.erb @@ -137,12 +137,16 @@ # 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