VCL question - where is cacheability determined?

David Miller meetheus at
Wed Jan 25 18:19:51 CET 2012

I'm converting from 2.1 to 3.0.  I got bit by the beresp.cacheable variable
going away, and replacing it with beresp.ttl > 0s doesn't work because ttl
hasn't been determined yet; it's a -1.000.

This is the block of code in question (in vcl_fetch)

        if (!beresp.cacheable && beresp.status != 404) {
                set beresp.http.X-Cacheable = "NO: !beresp.cacheable";
                return (pass);
        } else {
                # From
                /* Remove Expires from backend, it's not long enough */
                unset beresp.http.expires;

If beresp.ttl hasn't been determined yet, what's the appropriate

On a related note, I was looking at the source code for 2.1.  From my quick
reading, it looks like beresp.cacheable is determined by request type and
return status.  I don't see where apache/drupal/web-server cache headers
are consulted at all.

Am I missing something there?  Are back-end cache headers to be parsed in
VCL rather than being automagically determined?


--- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list