Posted by jusfeel on February 23, 2012 at 2:49am
I set up Varnish. But it cached the logged in homepage which I think it's because the ending of logging-in would actually redirect user to the homepage but cookie at that time has not been set yet for Varnish to be aware of and "pass" .
Tell me if I understand it wrong. ( After logged in, I visited other pages, they are not cached as it should not. No page should be cached once user logged in. ( What Pressflow cookie "LOGGED_IN" is for ). What happened to other pages should also happen on homepage but it's not. )
More importantly, how to stop this? I think I need to write something into Vanrish vcl config but don't know how.
Comments
What's in your VCL?
Can you post your VCL? Or are you using the defaults?
Drupal 6 or Drupal 7?
Do you have the Varnish module installed and configured properly?
What are the settings on the Drupal admin performance page?
VCL and other settings
It's actually Drupal5.
I have Varnish module installed. There is not much to configure from the backend. Only on the settings.php, added
to the conf array.
On the Performance page, cache is disabled. Aggregate and compress CSS files is also disabled.
For varnish to work properly,
For varnish to work properly, you need to replace Drupal core with PF5 (https://launchpad.net/pressflow/5.x). Take a look at http://groups.drupal.org/node/47734. The first version of the vcl in that post was written for varnish 1.x so you would have to modify it to work with 2.x (use beresp).
Thank you
Thank you for the reply. I'll be checking your link. Actually, it's PF5.x now.
One thing I want to achieve is to stop any caching behavior once user logged in. Obviously, Varnish is not doing that with "LOGGED_IN" cookie set already.
Could be...
Sounds like you store per user cache. Have you tried this:
# Routine used to determine the cache key if storing/retrieving a cached page.sub vcl_hash {
if (req.http.Cookie) {
# We don't want per user cache
# set req.hash += req.http.Cookie;
return (pass);
}
}
use Global Redirect
I used the Global Redirect module with the "force homepage redirect" option to fix the exact same problem. Credits to http://drupal.stackexchange.com/questions/28464/how-to-prevent-caching-o...
update: doesn't work for Firefox