Caching doubt

Jonathan Leibiusky ionathan at gmail.com
Tue Sep 7 13:09:06 CEST 2010


I think I didn't explain myself good enough and after playing with varnish I
realized that by default varnish won't forward to the backend If-None-Match
and If-Modified-Since headers.
Right now my backend is prepared to answer 304 when the resource hasn't been
modified, so I would like varnish to cache an object for X seconds and after
that use the ETag and Last-Modified sent by the backend to verify if the
expired resource is still the same and not ask directly for a fresh one.
Right now it always asks for a new one.

On Tue, Sep 7, 2010 at 1:34 AM, Bedis 9 <bedis9 at gmail.com> wrote:

> Hi,
>
> What kind of Vary header your webserver sends?
> If no, there is no reason to cache 3 versions of this object unless
> your conditionnal request does not match any header of the cached
> object.
>
> cheers
>
> On Mon, Sep 6, 2010 at 4:40 PM, Jonathan Leibiusky <ionathan at gmail.com>
> wrote:
> > Hi!
> > I'm playing with If-None-Match and Cache-Control: max-age   headers and I
> > have a doubt. Maybe it is more related to HTTP than Varnish, but it worth
> > asking.
> >
> > Imagine that I have 3 user-agents, a varnish and my webserver.
> > When the clients ask the first time for /example, varnish doesn't have
> > anything cached so he ask the webserver for it. The webserver response
> has
> > Cache-Control: max-age=180 and ETag: 123 (for example).
> > So Varnish will cache the response for 180 seconds as well as the
> > user-agents.
> > After 180 seconds, the 3 user-agents will request /example for a
> conditional
> > If-None-Match header because they got the ETag. Since it is a conditional
> > request varnish will ask the webserver and will get a fresh response with
> > all the caching headers. When the other 2 user-agent make the same
> > conditional request they will generate another request to the webserver
> > unless varnish has some mechanism to answer himself.
> > Is that right? Does varnish has this mechanism?
> >
> > Thanks!
> >
> > Jonathan
> >
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org
> > http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100907/fecc43ee/attachment-0003.html>


More information about the varnish-misc mailing list