caching everything incl. 403?

Loesche, Lukas, scoyo lukas.loesche at scoyo.com
Mon Dec 15 16:53:12 CET 2008


Hi,

our goal is to cache 'everything' for a while. Status 200 responses should
be kept for a week, everything else for 5 minutes. However I had some
problems figuring out what makes an object "cacheable" and what doesn't.

Our vcl:

...
...
sub vcl_fetch {
                
        /* Set NON-200 caching */
        if (obj.status != 200)
        {
                set obj.ttl = 300s;
        }
        elseif (obj.cacheable)
        {
                /* Remove Expires from backend */
                unset obj.http.expires;

                /* Set the clients TTL on this object */
                set obj.http.cache-control = "max-age = 21600";

                /* Set how long Varnish will keep it */
                set obj.ttl = 604800s;

                /* marker for vcl_deliver to set Age: */
                set obj.http.magicmarker = "1";
        }
}
...
...


Now the obj.ttl=300s Part works for Status "404 not found" responses,
however it doesn't for instance for "403 forbidden".

I was wondering, why. Why does a 403 always hit the backend with aboves vcl?

Also, what criteria has to be meet for if(obj.cacheable) to be true?

Best regards,
-- Lukas




More information about the varnish-misc mailing list