1
votes

I am implementing the boost module for Drupal on my site and have run into this caching problem. The site caches pages but when visiting as an anonymous user it gives me the wrong cached pages. I am based in Ireland and expect to see the Irish version of the site but once the home page is cached it gives me the american version of the site.

Here is a list of steps I took to implement Boost

  • First I go to /admin/config/development/performance and disable "Cache pages for anonymous users"
  • Then I enabled "Boost" and "Boost Crawler" on the modules page
  • I go to .HTACCESS and disable "Bypass the boost cache for ssl requests" because the live site has https.
  • I generate the .HTACCESS and insert it into the correct place in my own .HTACCESS file

I have a feeling that I may have to write some custom code in the .HTACCESS file to get it to work but would really like some more incite before I go ahead and to that.

Currently the uncached version of the site is served up correctly in each country but is very slow.

So to summarise really what I need Boost to do for me is cache something like 200 versions of the site (thats how many countries we are serving the site to) and to serve the correct versions of the site to those countries. Is this possible and how can I implement it?

Any help is very much appreciated, Thanks.

Update 1

after adding the code here to .HTACCESS

RewriteCond %{HTTP:Accept-Language} ^et.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /et [L,R=302]
RewriteCond %{HTTP:Accept-Language} ^fi.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /fi [L,R=302]

and visiting the site form several different proxies I get it to cache in its country but the problem now is that it just caches the 1st country an anonymous visitor comes form.

My home page is in cache/normal/SITES_NAME/en_.html it doesn't seem to matter what site I come from Brazil, Germany, America, South Africa or Ireland it just caches the first one in en_.html and serves that to everywhere when really it needs to create a new set of cache files for each of these countries.

I've been using geopeeker.com and different proxies to view the pages from different parts of the world.

1
It is strongly recommended not to use boost on a https site as any forms could private information, shop stock could change, and .htaccess also disables boost for https sites so there are multiple places to change. Link - drupal.org/node/1466480 might be helpful for you. - Pralhad Narsinh Sonar

1 Answers

1
votes

If you are using path prefix to detect language, Boost will not work.

You have to add this in your .htaccess to fix the problem.

RewriteCond %{HTTP:Accept-Language} ^et.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /et [L,R=302]
RewriteCond %{HTTP:Accept-Language} ^fi.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /fi [L,R=302]

This link provides further information.