<div dir="ltr">I meant exactly that, doesn't the answer of Kristian Lyngstol address this logic?<br><br><div class="gmail_quote">On Thu, Sep 15, 2011 at 5:07 PM, <a href="mailto:jon.gilbert@net-entwicklung.de">jon.gilbert@net-entwicklung.de</a> <span dir="ltr"><<a href="mailto:jon.gilbert@net-entwicklung.de">jon.gilbert@net-entwicklung.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>
 
    
 
 <div>
  <p style="margin:0">
   <span>
    <span>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.</span>
   </span>
  </p>
  <p style="margin:0"> </p>
  <p style="margin:0">
   <span>
    <span>I think I get what you want to do, but I'm not sure that Varnish will support that. Sorry</span>
   </span>
  </p>
  <p style="margin:0"> </p>
  <p style="margin:0">
   <span>
    <span>Jon</span>
   </span>
  </p>
  <p style="margin:0">
   <span>
    <span>
     <br>
    </span>
   </span>
  </p>
  <p> </p>
  <div style="margin:5px 0px 5px 0px;font-family:monospace">
   <br>
   Barak Yaish <<a href="mailto:barak.yaish@gmail.com" target="_blank">barak.yaish@gmail.com</a>> hat am 15. September 2011 um 15:51 geschrieben:
   <br><div><div></div><div class="h5">
   <br>
   > Wow, that was quick! :-)
   <br>
   >
   <br>
   > Ok, may I describe my backend and then can you suggest whether or not
   <br>
   > Varnish will suite here?
   <br>
   >
   <br>
   > The server (Tomcat) basically acts as a cache, where the key is page url and
   <br>
   > the value is some info on the page. Clients accessing the service pass the
   <br>
   > url in the request, and if the data exist in the cache, it will be returned
   <br>
   > to client, otherwise a default response will be returned to client, and a
   <br>
   > background process will start process the page, in its end the page data
   <br>
   > will be placed in the cache. So, since Tomcat (java) do not handle network
   <br>
   > very well in high scales, I was thinking I could use Varnish to cache
   <br>
   > backend responses in case found in the service cache. Isn't it possible to
   <br>
   > configure Varnish to fetch from cache based on some header in the request
   <br>
   > (in my case it will be the page url that client is querying)?
   <br>
   >
   <br>
   > Hope I was clear enough,
   <br>
   >
   <br>
   > Barak.
   <br>
   >
   <br>
   > On Thu, Sep 15, 2011 at 4:25 PM, Per Buer <<a href="mailto:perbu@varnish-software.com" target="_blank">perbu@varnish-software.com</a>>wrote:
   <br>
   >
   <br>
   > > Hi,
   <br>
   > >
   <br>
   > >
   <br>
   > > On Thu, Sep 15, 2011 at 3:19 PM, Barak Yaish <<a href="mailto:barak.yaish@gmail.com" target="_blank">barak.yaish@gmail.com</a>>wrote:
   <br>
   > >>
   <br>
   > >>
   <br>
   > >> I'm new to Varnish, and I didn't find in the docs how to do the following
   <br>
   > >> - cache the response based on customized HTTP header (which the backend may
   <br>
   > >> or may not set), for example cache the response in case the one of the
   <br>
   > >> response headers is "SomeHeader".
   <br>
   > >>
   <br>
   > >
   <br>
   > > How will Varnish know the value of the response header before it has talked
   <br>
   > > to the backend?
   <br>
   > >
   <br>
   > > Cache lookups happend after we get the request, and at that time the
   <br>
   > > response headers are unknown. You need to figure out what content to deliver
   <br>
   > > purely based on the request.
   <br>
   > >
   <br>
   > > --
   <br></div></div><div class="im">
   > > Per Buer, CEO
   <br>
   > > Phone: <a href="tel:%2B47%2021%2098%2092%2061" value="+4721989261" target="_blank">+47 21 98 92 61</a> / Mobile: <a href="tel:%2B47%20958%2039%20117" value="+4795839117" target="_blank">+47 958 39 117</a> / Skype: per.buer
   <br>
   > > *Varnish makes websites fly!*
   <br></div>
   > > Whitepapers <<a href="http://www.varnish-software.com/whitepapers" target="_blank">http://www.varnish-software.com/whitepapers</a>> | Video<<a href="http://www.youtube.com/watch?v=x7t2Sp174eI" target="_blank">http://www.youtube.com/watch?v=x7t2Sp174eI</a>> |
   <br>
   > > Twitter <<a href="https://twitter.com/varnishsoftware" target="_blank">https://twitter.com/varnishsoftware</a>>
   <br>
   > >
   <br>
   > >
   <br>
   > >
  </div>
 </div>
</blockquote></div><br></div>