1

Is there a standard, or well accepted, method for allowing page caching when you have multiple versions of page, that don't involve using Page Manager?

For example, if you render out different versions of a page based on IP address, User-Agent, etc., page caching renders the code-based decisions useless, so some users may see the wrong pages.

The only method that I know about involves adding code to settings.php to alter $_SERVER['REQUEST_URI'] to make the code-based decision and then to tack on extra variables, but gets messy.

1

$_SERVER['REQUEST_URI'] is the simplest way. The other option is to modify the key used in the cache. There is a 6.x memcache patch that I've been using http://drupal.org/node/942914

The latest version of http://drupal.org/project/authcache might be able to do it.

  • Thanks for the leads. Do you know if there is a hook when you can still mess with $_SERVER['REQUEST_URI']? I haven't been able to fully unravel this yet. – mpdonadio Jan 16 '13 at 19:08
  • It needs to happen before hook_boot so there is no "hook" that can be used. Easiest is to include a file in settings.php that will modify $_SERVER['REQUEST_URI']. If this is not an option patching your cache backend file is the other option. I've used both methods. $_SERVER['REQUEST_URI'] works best for simple things like other $_SERVER variables. patching the cache backend works best for things like IP Geo location. – mikeytown2 Jan 16 '13 at 23:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.