neverending saga of varnish + joomla
lajo at kb.dk
Tue Aug 9 11:15:49 CEST 2011
Good write-up. But do you really need to make Joomla send special headers to Varnish, though? If a cookie is present in the client request, Varnish will automatically pass the request to the backend (unless you've tinkered in vcl_recv). Like this:
1. req index.html, no cookies present
2. Varnish: hit, strip set-cookie
3. req news.html, no cookies present
4. Varnish: hit, strip set-cookie
5. req login.html, no cookies present
6. Varnish: pass, allow set-cookie
7. req index.html, cookie present
8. Varnish: pass, cookie present
9. req news.html, cookie present
10. Varnish: pass, cookie present
As you see, once users log in, everything gets passed. Or piped, if you prefer, but pass should be your first choice.
From: varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Kevin
Sent: Tuesday, August 09, 2011 12:13 AM
To: varnish-misc at varnish-cache.org
Subject: RE: neverending saga of varnish + joomla
I thought I’d send a note that I have finally gotten Varnish to work with Joomla. I wanted to say thanks to everyone on this list that has helped me throughout the last little while until I finally got it working.
I ended up modifying the joomla code to send an additional HTTP header to identify if the session was logged in or not, as well , I heeded the advice here and stripped all cookies except for the login page, among a few other things.
I detailed my experiences in my blog , if anyone is interested. I tried to be as detailed as possible :
From: Mitch Pirtle [mailto:mitch at spacemonkeylabs.com]
Sent: Monday, August 08, 2011 3:29 AM
Cc: <varnish-misc at varnish-cache.org>
Subject: Re: neverending saga of varnish + joomla
On 07/ago/2011, at 22:42, "Kevin" <k at kevinkevin.com<mailto:k at kevinkevin.com>> wrote:
The problem is varnish is having a very very difficult time knowing when to pipe or pass the traffic to the backend webserver if a logged in session happens. It seems that unless you patch joomla to do its own internal checks and determine if a user is anonymous or not, and send a custom http header that varnish can read, there is no other real way to make varnish work with joomla.
You can accomplish this by writing a Joomla plugin that does these things.
There are example plugins in the Joomla wiki (I'm loitering outside and don't have access right now, sorry!) and I believe there is a simple plugin example provided in the 1.5 distribution.
Essentially think of Joomla plugins as database triggers and stored procedures. When a specific event fires in the execution stack, any plugins for that event are fired as well.
Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-misc