1

Problem :

On multilingual site, varnish caching is enabled. When any user call www.example.com, page gets cached to the first visitor's language preferences. All subsequent visitors get pages in that first visitor's language rather than their own. For Example : first visitor browse www.example.com then language selection page apears and visitor select language and entered to the website. (www.example.com/fr) Then second visitor browse same url www.example.com then visitor redirected to www.example.com/fr instead of language selection page.

Some details :

We are using cookie to determine the language which gets set when user select language preference. If we exclude homepage from cache it works fine but we don't want to exclude this page as this is the homepage of website.

Question : How we can set varnish or Drupal to read cookie from browser and display language selection page ? OR Varnish should detect language cookie and if not set then display language selection page ?

Thanks in advance.

  • "How we can set varnish or Drupal" - you need to set up both. Drupal, to set separate cookie for language, and Varnish to respect it. Why don't you use language prefixes? – Mołot Jun 21 '15 at 21:00
  • Oh, and by the way, your users are not redirected. No redirection occurs here, they are just server wrong version of content - your title is misleading, please fix it. – Mołot Jun 21 '15 at 21:13
  • Solved - We added javascript code to read cookie and redirected to language page. This solved our problem. Thanks for help. – user2114603 Aug 24 '15 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.