Enable Client Cache control Headers

Anand Shah imanandshah at gmail.com
Mon Jul 22 11:49:18 CEST 2013


Hi,

I am trying to enable client side cache handling but not working for some
unknown reasons. I will get two parameters to read from origin's response

.i.e


1. Edge-control: downstream-ttl=200s

2. Edge-control: cache-maxage=200s





RULES:-


This goes in vcl_fetch

  if ( beresp.http.Edge-control ) {
                if (beresp.http.Edge-control ~ "cache-maxage") {
                        set beresp.ttl =
std.duration(regsub(beresp.http.Edge-control, "cache-maxage=([0-9]+).*",
"\1s"), 0s);
                        #set beresp.http.Cache-Control =
regsub(beresp.http.Edge-control, ".*cache-maxage=([0-9a-z]+).*", "\1");
                        #set beresp.http.X-AGEBACKEND = "yes";
                } elseif ( beresp.http.Edge-control ~
"downstream-ttl=([0-9]+)s")  {
                        set beresp.http.Cache-Control =
regsub(beresp.http.Edge-control, "downstream-ttl=([0-9]+).*", "maxage=\1" +
"s");
                }
                unset beresp.http.Edge-control;
                return (deliver);
        }



It exists as soon as it matches any of the criteria and does not do a
lookup for other Cache parameter and delivers.


 1. It should enter the loop only if the Response header has Edge-Control.

2. check for matching parameters and set else follow the vcl.

3. If only cache-maxage contains it should check for Cache Control headers
below in the vcl (this does not work; want it to work)



No Idea what is going is wrong here.











 Regards,

   Anand Shah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130722/52903847/attachment.html>


More information about the varnish-misc mailing list