again cookies problem...

Dag-Erling Smørgrav des at linpro.no
Wed Aug 29 13:04:17 CEST 2007


"Monty Ree" <chulmin2 at hotmail.com> writes:
> If I don't set like this at vcl, the web site which using cookies,
> loading is too slow.

By default, Varnish bypasses the cache if the client sends a cookie or
the server sets one.

> if (req.request == "GET" && req.http.cookie) {
>     lookup;
> }
>
> But, when I set like above, someone who visits the site, can see
> previous connected person information.

Precisely.

> So I changed like below,
>
>  if (req.request == "GET" && req.http.cookie && req.url ~ "\.(gif|jpg|swf|css|js)$") {
>      lookup;
>  }

So images, stylesheets and JavaScript will be cached no matter what,
which is usually a good idea, but other documents will not be cached
if a cookie is involved.

> After I set above, the problem which anyone can see others'
> information is solved.

Precisely.

> But this config makes the site a bit slow too.  I don't know why.

Because the cookies prevent Varnish from caching it.  There isn't
really anything you can do about it unless you redesign your site to
not use cookies.

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no



More information about the varnish-misc mailing list