2

I'm scratching my head for 2 days with no luck. I've configured Varnish 3 with Pressflow 6 (Drupal) and everything is good i.e. Varnish is caching the pages. Now the pain is Varnish is caching even after login. So when i do logout i still see your are logged in messages etc.

I tried to set a unique cookie upon Login in modules/user/user.module file and modified the /etc/varnish/default.vcl file adding the following block.

if (req.http.Cookie ~ "(MY_UNIQUE_COOKIE)") {
  return (pass);
}

Everything works as expected now but in logout script, i am not able to completely delete the cookie via PHP i.e. setting the time in minus. I believe the actual cookie goes away after the browser is closed/restarted.

So now onwards, if i don't close the browser, the cookie is there and Varnish always send every page to Apache Backend.

Any help would be highly appreciated.

Regards,

Raheel

Raheel Dharolia
  • 203
  • 1
  • 4
  • 13

2 Answers2

0

I know this is an old question, but I thought I could provide some input about this.

I don't know Varnish's syntax yet, but on logout you could set the value of the cookie to be empty. Then you can strip all of the empty cookies out of the headers in VCL. This will make varnish behave the way you intend.

0

The first 3 Google results for "drupal pressflow varnish" are gold. 2 posted because I apparently don't have enough rep but the osuosl blog post is really good to if maybe a little dated

  1. http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal
  2. https://wiki.fourkitchens.com/display/PF/Configure+Varnish+for+Pressflow

Also, you should never modify Drupal's core code. It will make your life upgrading miserable and anything you would want to do you can almost certainly manage with the integration points and maybe a litte ingenuity

Finally, as you will notice in the linked articles, there is no reason to set your own cookie because Pressflow and Drupal 7+ have optimized session creation so the session cookie already provides the functionality you're looking for.

  • Thanks Neil. We're in the process to move our app from Drupal to Yii. I'm back to stackoverflow after such a longtime to read your answer... :) – Raheel Dharolia Nov 06 '12 at 15:30