08 Oct 2010 @ 11:00 AM 

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, &timestruct);
strftime(timebuf, 30, format, &timestruct);
VRT_SetHdr(sp, HDR_BERESP, “\010Expires:”, timebuf, vrt_magic_string_end);
}C

return(deliver);
}

Posted By: caunter
Last Edit: 08 Oct 2010 @ 11:04 AM

EmailPermalink
Tags
Categories: Varnish Cache


 

Responses to this post » (None)

 
Post a Comment

You must be logged in to post a comment.


 Last 50 Posts
 Back
Change Theme...
  • Users » 328
  • Posts/Pages » 44
  • Comments » 1
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Music



    No Child Pages.