<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>We're actually thinking about the possibility of scrubbing
Cache-Control, Age, and Expires on the varnish output, and using NGINX
(already our load balancer in front of varnish) to programatically set
an expires header for the client on the way out.  Of course it would be
much cleaner, and less human-error-prone if we could do something like
this in vcl_deliver:<br>
<br>
set res.http.Expires = 300;<br>
<br>
Nobody would have to remember that one last piece of it was hanging out
in the load balancer...<br>
<br>
DK<br>
</tt><br>
Audun Ytterdal wrote:
<blockquote cite="mid:487C6485.2090109@vg.no" type="cite">
  <pre wrap="">Demitrious Kelly wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hey guys!

Lets sat I have some dynamically generated content that I would like
varnish to cache for, say a month.  When this content is updated I'm
invalidating the cache via a url.purge.  I therefor want the world
outside to check back in with varnish every 10 minutes.

So in the response to varnish I have set the Expires to be 1 month from
the request, and in the vcl I'm doing the following:

sub vcl_deliver {
    remove resp.http.Expires;
    remove resp.http.Cache-Control;
    remove resp.http.Age;
    set resp.http.Cache-Control = "max-age=600, proxy-revalidate";
    set resp.http.Age = "0";
    deliver;
}

The problem is that this feels like the wrong way to be approaching the
problem, and doesn't seem very "correct" as far as HTTP protocol
observance is concerned. What would be the best way to implement such a
scenario?

Secondarily is there any nifty mechanism for generating an expires
header with the VCL? I would imagine that the cleanest way to do this
would be to drop the cache-control idea and go with an expires always
set to 600 seconds from now on the vcl_deliver.
  
    </pre>
  </blockquote>
  <pre wrap=""><!---->You could use smax-age instead of max-age. smax-age is shared cache max
time.
varnish uses smax-age and max-age. Only problem is that any other shared
caches (such as a local squid in front of the client) also would use
smax-age

I would also like som sort of "max-age, only for varnish"-header.

--
Audun

*****************************************************************
Denne fotnoten bekrefter at denne e-postmeldingen ble
skannet av MailSweeper og funnet fri for virus.
*****************************************************************
This footnote confirms that this email message has been 
swept by MailSweeper for the presence of computer viruses.
*****************************************************************

  </pre>
</blockquote>
</body>
</html>