Varnish : how to add an exception for dynamic pages with cookies

Josh josh at schulzone.org
Fri Feb 18 16:31:00 CET 2011


On Fri, Feb 18, 2011 at 7:19 AM, Roch Delsalle <rdelsalle at gmail.com> wrote:
> Hi,
>
> I would like to know what's the right way to avoid caching "some pages" of a
> website using Varnish and cache all the others.
>
> This is what I have tried to do with the vcl conf:
>
> sub vcl_fetch {
>         #set beresp.ttl = 1d;
>         if (!(req.url ~ "/page1withauth") ||
>             !(req.url ~ "/page2withauth")) {
>            unset beresp.http.set-cookie;
>         }
>         if (!beresp.cacheable) {
>             return (pass);
>         }
>         if (beresp.http.Set-Cookie) {
>             return (pass);
>         }
>         return (deliver);
> }
>
> Thanks
>
> --
> D-Ro.ch
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



-- 
josh
@schulz
http://schulzone.org




More information about the varnish-misc mailing list