Use this vcl_fetch to add a custom Expires header to objects. This example adds one day (86400 seconds).
sub vcl_fetch {
set beresp.grace = 4h;
set beresp.ttl = 300s;
C{
#include
static char timebuf[30];
char *format = {“%a, %d %b %Y %H:%M:%S GMT”};
struct tm timestruct;
time_t now;
time(&now);
now+=86400;
gmtime_r(&now, ×truct);
strftime(timebuf, 30, format, ×truct);
VRT_SetHdr(sp, HDR_BERESP, “\010Expires:”, timebuf, vrt_magic_string_end);
}C
return(deliver);
}
 
              Run this command to output all the C that varnishd compiles at runtime:
/usr/local/sbin/varnishd -C -f ./default.vcl > file
 
              
 Categories
          Categories Tag Cloud
          Tag Cloud Blog RSS
          Blog RSS Comments RSS
          Comments RSS
 Last 50 Posts
Last 50 Posts
 Back
Back Void « Default
Void « Default Life
Life  Earth
Earth  Wind
Wind  Water
Water  Fire
Fire  Light
Light 