Mailing List Archive

Zope/Plone and Varnish
Hello,

Im trying vernish out. I compiled it from source, everything nice.
I then used CacheFu to generate the vcl file. Im running Varnish in
port 80 .
It has some strange behauviour I cannot explain, if enable cache on
authenticated sessions the page screws up badly, seams css doesnt load
and I cant understand why.

Also sending content using the form (Exfile, or image) doesnt work.


/* Do not cache when authenticated via HTTP Basic or Digest
Authentication */
if (req.http.Authenticate || req.http.Authorization) {
/* pipe; */
lookup;
}

/* Do not cache when authenticated via "__ac" cookies */
if (req.http.Cookie && req.http.Cookie ~ "__ac=") {
/* pipe; */
lookup;
}

/* Do not cache when authenticated via "_ZopeId" cookies */
if (req.http.Cookie && req.http.Cookie ~ "_ZopeId=") {
/* pipe; */
lookup;
}


Other thing is: Can I make lets say a /content on Varnish to be
http://remote.url/var/$1
On my website I fetch an html from another server using Ajax and it
doesnt work because ajax cant
communicate with other domains because of security issues.



Any tips ?

Thanks
Joao Correia
Zope/Plone and Varnish [ In reply to ]
Joao Correia wrote:
> Hello,
>
> Im trying vernish out. I compiled it from source, everything nice.
> I then used CacheFu to generate the vcl file.

CacheFu generates VCL files now?

In any case, discussions of Zope/Plone and CacheFu are not directly
appropriate here, I doubt the Varnish developers know much about it.

> Im running Varnish in
> port 80 .
> It has some strange behauviour I cannot explain, if enable cache on
> authenticated sessions the page screws up badly, seams css doesnt load
> and I cant understand why.

I'm using Varnish 1.0.4 with CacheFu 1.1 and Plone 3.0 on my website.
Varnish 1.0.4 will only compile on Linux, BSD and similar (i.e. not on
OS X) so be aware of that.

Lots of people (i.e. everyone I've spoken to) have reported problems
with Varnish 1.1.1 in front of Plone (though it's not directly a Plone
problem, since accessing it directly does not exhibit the same behvaiour
- it could of course be some bad cache headers, but I've been unable to
confirm that). I experience periodic "dropped" requests or requests that
never complete (see other thread on this list). I'm really hoping
someone can get to the bottom of this, since being stuck on an older
version is not ideal. :-(

Martin

--
Acquisition is a jealous mistress
Zope/Plone and Varnish [ In reply to ]
"Joao Correia" <joao.correia at gmail.com> writes:

> Im trying vernish out. I compiled it from source, everything nice.
> I then used CacheFu to generate the vcl file.

Could you post the complete generated vcl file from CacheFu, please?

> Im running Varnish in port 80.

Do you do rewriting somewhere, or do you map hostname to path in your
virtualhostmonster config?

> It has some strange behauviour I cannot explain, if enable cache on
> authenticated sessions the page screws up badly, seams css doesnt
> load and I cant understand why.
>
> Also sending content using the form (Exfile, or image) doesnt work.

Looking at the logs will tell you what varnish does with each request:

## Recieved client requests to varnish
varnishlog -r /var/log/varnish/varnish.log -o -c RxURL /IEFixes.css

## Varnish requests sent to backend
varnishlog -r /var/log/varnish/varnish.log -o -b TxURL /IEFixes.css

--
Stig Sandbeck Mathisen, Linpro
Zope/Plone and Varnish [ In reply to ]
On Sep 13, 2007, at 5:03 AM, Joao Correia wrote:

> Hello,
>
> Im trying vernish out. I compiled it from source, everything nice.
> I then used CacheFu to generate the vcl file. Im running Varnish in
> port 80 .


First, this may not be the best list for your questions. If you need
help with Plone/CacheFu, it might be more productive to try the Plone
support forums (http://plone.org/support)

Second, the Varnish configs generated by CacheFu are labeled "beta"
as they haven't been completely tested yet. (perhaps they should
have been labeled 'alpha').

Third, CacheFu's varnish-in-front config in particular has not been
tested well as it depends on the new varnish string substitution
feature which was recently introduced in Varnish 1.1 (which for
unknown reasons is currently unstable with the Plone configuration).


> It has some strange behauviour I cannot explain, if enable cache on
> authenticated sessions the page screws up badly, seams css doesnt load
> and I cant understand why.


Another problem. None of the CacheFu configs are designed to cache
authenticated sessions.


> Also sending content using the form (Exfile, or image) doesnt work.


Sorry, "doesn't work" is not enough information.



> /* Do not cache when authenticated via HTTP Basic or Digest
> Authentication */
> if (req.http.Authenticate || req.http.Authorization) {
> /* pipe; */
> lookup;
> }
>
> /* Do not cache when authenticated via "__ac" cookies */
> if (req.http.Cookie && req.http.Cookie ~ "__ac=") {
> /* pipe; */
> lookup;
> }
>
> /* Do not cache when authenticated via "_ZopeId" cookies */
> if (req.http.Cookie && req.http.Cookie ~ "_ZopeId=") {
> /* pipe; */
> lookup;
> }
>


These are probably *bad* changes to the config unless you also add
some extra cache keys for varnish to keep track of the authenticated
pages.



> Other thing is: Can I make lets say a /content on Varnish to be
> http://remote.url/var/$1
> On my website I fetch an html from another server using Ajax and it
> doesnt work because ajax cant
> communicate with other domains because of security issues.


Sorry, I don't understand what this has to do with Varnish.

Ric