Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Enable Client Cache control Headers

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


imanandshah at gmail

Jul 22, 2013, 2:49 AM

Post #1 of 1 (59 views)
Permalink
Enable Client Cache control Headers

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

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.