Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
totem
website
Commits
58a99574
Unverified
Commit
58a99574
authored
Dec 16, 2020
by
Maarten de Waard
🤘🏻
Browse files
set correct htaccess, set SameSite=Strict correctly
parent
2dbcf8c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
.htaccess
View file @
58a99574
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
]
source/javascripts/index.js
View file @
58a99574
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment