My drupal site uses normal cache system, as you'll probably know, the cache_page table is updated using as primary key the REQUEST_URI. This is great because when an anonymous user requests a page, drupal serves it to the client from the cache_page, and the best part is that all variables in the GET request are part of the cache id for serving that page.
So for example if I have these URL's
http://domain.com/gallery
http://domain.com/gallery?list_mode=thumbs
Both url's are different in the cache_page table.
The problem comes here, I want anonymous users to remember the last option that selected as "list_mode", so the next time they come they'll get one or another list mode by default. So I added list_mode as a SESSION var. The problem is that accessing
http://domain.com/gallery
as anonymous, the page is served from cache with the default list_mode. (whose value is not "thumbs")
I don't want to stop using cache_page for this url (this was a possible solution), and the ideal thing would be adding some way this SESSION variable to the REQUEST_URI so the page will be served as it should , in this case would consist of translating:
http://domain.com/gallery
TO http://domain.com/gallery?list_mode=thumbs
before checking the cache, so the user gets the second URL served instead of the first.
hook_boot
would be a good place to do that, but I don't think that hacking the request_uri is a good idea, so, is there any other way to do this approach ?
Thanks for your help.
PS: I found a similar issue, the user makes use of the RewriteCond to achieve what he wants, and asks for a better solution, but the only answer advises to disable caching for that pages: Cache page based on cookie value and URL