Caching based on response header

Barak Yaish barak.yaish at gmail.com
Thu Sep 15 16:20:09 CEST 2011


I meant exactly that, doesn't the answer of Kristian Lyngstol address this
logic?

On Thu, Sep 15, 2011 at 5:07 PM, jon.gilbert at net-entwicklung.de <
jon.gilbert at net-entwicklung.de> wrote:

> **
>
>  I think you mean, you want Varnish to pass the call through to tomcat and
> if the response has header XYZ then cache it for the next call. If header
> XYZ is not there, do not cache the response, so the next call goes directly
> to Tomcat too. As soon as Tomcat has the correct page it returns the
> response with the header XYZ and Varnish caches the response. All subsequent
> calls to Varnish then get a cache hit.
>
>
>
>  I think I get what you want to do, but I'm not sure that Varnish will
> support that. Sorry
>
>
>
>  Jon
>
>
>
>
> Barak Yaish <barak.yaish at gmail.com> hat am 15. September 2011 um 15:51
> geschrieben:
>
> > Wow, that was quick! :-)
> >
> > Ok, may I describe my backend and then can you suggest whether or not
> > Varnish will suite here?
> >
> > The server (Tomcat) basically acts as a cache, where the key is page url
> and
> > the value is some info on the page. Clients accessing the service pass
> the
> > url in the request, and if the data exist in the cache, it will be
> returned
> > to client, otherwise a default response will be returned to client, and a
>
> > background process will start process the page, in its end the page data
> > will be placed in the cache. So, since Tomcat (java) do not handle
> network
> > very well in high scales, I was thinking I could use Varnish to cache
> > backend responses in case found in the service cache. Isn't it possible
> to
> > configure Varnish to fetch from cache based on some header in the request
>
> > (in my case it will be the page url that client is querying)?
> >
> > Hope I was clear enough,
> >
> > Barak.
> >
> > On Thu, Sep 15, 2011 at 4:25 PM, Per Buer <perbu at varnish-software.com>wrote:
>
> >
> > > Hi,
> > >
> > >
> > > On Thu, Sep 15, 2011 at 3:19 PM, Barak Yaish <barak.yaish at gmail.com>wrote:
>
> > >>
> > >>
> > >> I'm new to Varnish, and I didn't find in the docs how to do the
> following
> > >> - cache the response based on customized HTTP header (which the
> backend may
> > >> or may not set), for example cache the response in case the one of the
>
> > >> response headers is "SomeHeader".
> > >>
> > >
> > > How will Varnish know the value of the response header before it has
> talked
> > > to the backend?
> > >
> > > Cache lookups happend after we get the request, and at that time the
> > > response headers are unknown. You need to figure out what content to
> deliver
> > > purely based on the request.
> > >
> > > --
> > > Per Buer, CEO
> > > Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
> > > *Varnish makes websites fly!*
> > > Whitepapers <http://www.varnish-software.com/whitepapers> | Video<
> http://www.youtube.com/watch?v=x7t2Sp174eI> |
> > > Twitter <https://twitter.com/varnishsoftware>
> > >
> > >
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110915/7250b296/attachment-0003.html>


More information about the varnish-misc mailing list