should beresp will be added into cache?

Junxian Yan junxian.yan at gmail.com
Tue Mar 8 08:16:50 CET 2011


Hi Guys

I added some logic to change the beresp header in vcl_fetch. And I also do
lookup for the same request in vcl_recv.

The handling process I expected should be:  the first incoming request will
be changed by fetch logic and the second request should use the cache with
the changed part
But the actually result is the change parts are not be cached

Here is my code:
in vcl_fetch
  if (req.url ~ "/(images|javascripts|stylesheets)/") {
    unset beresp.http.Set-Cookie;
    set beresp.http.Cache-Control = "private, max-age = 3600,
must-revalidate"; # 1 hour
    set beresp.ttl = 10m;
    set beresp.http.clientcache = "1";
    return(deliver);
  }

And I also wanna the response of the second request have the max-age = 3600
and clientcache = 1. The actual result is max-age = 0 and no clientcache in
response

Found some explanation in varnish doc lib, seems not as exactly as I
expected. Is the beresp inserted into cache totally?

deliverPossibly insert the object into the cache, then deliver it to the
client. Control will eventually pass to vcl_deliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110307/fd4c15b8/attachment-0003.html>


More information about the varnish-misc mailing list