[Varnish] #225: VCL: Allow "Expires" time to be easily specified / calculated

Varnish varnish-bugs at projects.linpro.no
Tue Apr 1 00:09:27 CEST 2008

#225: VCL: Allow "Expires" time to be easily specified / calculated
 Reporter:  cyberduck    |       Owner:  phk  
     Type:  enhancement  |      Status:  new  
 Priority:  normal       |   Milestone:       
Component:  varnishd     |     Version:  trunk
 Severity:  normal       |    Keywords:       
 In some situations it would make sense to alter or set an "Expires: "
 entry in the header to alter how browsers will cache objects.

 Currently this is not possible because there is no way of calculating
 Expires timestamps from VCL.

 A workaround that in limited testing seems to work (using C) is :
 #include <time.h>
   char l_str_buf[64];
   time_t l_expire = time(NULL)+(60*15); /* Expire after 15 minutes */
   size_t l_retval = strftime(l_str_buf, 64, "%a, %d %b %Y %H:%M:%S GMT",
 gmtime(&l_expire) );
   if (l_retval) {
     VRT_SetHdr(sp, HDR_OBJ, "\010Expires:", l_str_buf, 0);

Ticket URL: <http://varnish.projects.linpro.no/ticket/225>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list