Unverified Commit 58a99574 authored by Maarten de Waard's avatar Maarten de Waard 🤘🏻
Browse files

set correct htaccess, set SameSite=Strict correctly

parent 2dbcf8c8
RewriteEngine on
RewriteBase /
# Don't rewrite if English has been chosen
RewriteCond %{HTTP_COOKIE} ^openedx-language-preference=en$ [NC]
RewriteRule ^/?(terms.html|privacy.html)?$ $1 [L]
RewriteCond %{HTTP_COOKIE} ^.*openedx-language-preference=en.*$ [NC]
RewriteRule ^/?(index.html|terms.html|privacy.html)?$ $1 [L]
# Rewrite to language from cookie
RewriteCond %{HTTP_COOKIE} ^openedx-language-preference=(ar|es|fa|fr)$ [NC]
RewriteRule ^/?(terms.html|privacy.html)?$ /%1/$1 [L]
RewriteCond %{HTTP_COOKIE} ^.*openedx-language-preference=(ar|fr|es|fa).*$ [NC]
RewriteRule ^/?(index.html|terms.html|privacy.html)?$ /%1/$1 [L,R=300]
# Rewrite non-English supported languages
RewriteCond %{HTTP:Accept-Language} ^.*(ar|es|fa|fr).*$ [NC]
RewriteRule ^/?(terms.html|privacy.html)?$ /%1/$1 [L]
RewriteRule ^/?(index.html|terms.html|privacy.html)?$ /%1/$1 [L,R=300]
......@@ -66,16 +66,14 @@
});
});
document.setLangCookie = function(lang) {
console.log("Setting lang to " + lang);
var expiryDate = new Date();
expiryDate = expiryDate.setMonth(expiryDate.getMonth() + 12);
var domain = window.location.hostname;
var cookieParams = "domain=." + domain + ";path=/;SameSite=Strict";
var cookieParams = "domain=." + domain + ";path=/;SameSite=Strict;";
if (window.location.protocol == "https") {
cookieParams += "secure=true;"
}
document.cookie = "openedx-language-preference=" + lang + ";expires=" + expiryDate + ";" + cookieParams;
console.log("Saved document cookie" + document.cookie);
};
})(jQuery, window, document);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment