On Fri, May 20, 2016 at 4:38 PM, Pinakee BIswas <[email protected]> wrote:

> Hi,
>
> I am a beginner with Varnish and planning to deploy it for our ecommerce
> live platform. I am trying to learn Varnish and VCL and having trouble for
> our specific scenario:
>
> I would like to cache pages when a user is not logged in - and this is
> determined by a cookie (which is standard). The ecommerce platform is based
> on python Django - and there are bunch of other cookies which are not
> relevant for caching but they can't be unset/removed as they are needed by
> the origin/backend server.
>
> Hence, the solution would be to check if the login cookie is present or
> not. If login cookie not present, cache the page and fetch from cache else
> pass it to the backend.
>

Two tips. One is the cookie VMOD, which helps when dealing with cookies. If
you don't wanna use it you can also look at the example here:
https://www.varnish-cache.org/docs/4.1/users-guide/increasing-your-hitrate.html#cookies
- it will at least point you in the right direction.



> I tried implementing the above logic in vcl_recv and vcl_backend_response
> with my limited knowledge, but varnish started serving blank pages.
>

That sounds like a backend bug.

-- 
*Per Buer*
CTO | Varnish Software AS
Cell: +47 95839117
We Make Websites Fly!
www.varnish-software.com
<http://info.varnish-software.com/signature>
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to