Bump the language cookie expiry for visits during the expiry period
[mirror/dsa-puppet.git] / modules / roles / templates / apache-www.debian.org.erb
index 2253aa7..e1759db 100644 (file)
    # 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