Question

J'ai un cookie pour la langue. Je veux vérifier si ce cookie est réglé et pour vérifier sa valeur pour rediriger l'utilisateur vers la page spécifique. le nom du cookie est Lang et sa valeur peut être Fr, Fr, ou Ar

if (req.http.Cookie ~ "Lang"){
//now i want to check for the cookie value
//if LANG=="Ar"
// set req.url =  req.url "CookieValue"
}

Quelqu'un sait comment vérifier la valeur du cookie dans le vernis ??
Merci

Était-ce utile?

La solution

Vous pouvez essayer:

if (req.http.Cookie ~ "Lang=En") {
   // do something with the English cookie
}
if (req.http.Cookie ~ "Lang=FR") {
   // do something with the French cookie
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top