Varnish (running on fastly) is caching objects for longer than I (think I) have specified. To debug this issue, I'm adding headers everywhere in the following fashion:
sub vcl_miss {
set req.http.Debugmiss = "vcl_miss";
#FASTLY miss
return(fetch);
}
sub vcl_deliver {
#FASTLY deliver
set resp.http.Debugmiss = req.http.Debugmiss;
return(deliver);
}
I've done this for vcl_recv
, vcl_hit
, vcl_miss
, vcl_pass
, vcl_hash
and vcl_fetch
; however, the only functions that seem to be called according to the headers are vcl_recv
(which does a lookup) and vcl_deliver
. For example, according to the state diagram (https://www.varnish-software.com/book/3/_images/vcl.png) after vcl_recv
returns the lookup
code, the vcr_hash
function should be called. If it is, it doesn't seem to set any headers.
Is there something I'm overlooking?
These are the response headers that curl returns:
< HTTP/1.1 200 OK
< Server: Cowboy
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Etag: W/"9fbfd39142780bd83fed663b051c83d9"
< X-Request-Id: a2a9b83a-4143-4b40-b788-94969dd5ce91
< X-Runtime: 0.020195
< X-Rack-Cache: miss
< Via: 1.1 vegur
< Content-Length: 434
< Accept-Ranges: bytes
< Date: Wed, 02 Sep 2015 13:41:41 GMT
< Via: 1.1 varnish
< Age: 4
< Connection: keep-alive
< X-Served-By: cache-lhr6332-LHR
< X-Cache: HIT
< X-Cache-Hits: 1
< X-Timer: S1441201301.048931,VS0,VE2
< Cache-Control: no-cache, no-store, private, must-revalidate, max-age=0, max-stale=0, post-check=0, pre-check=0
< Expires: 0
< Pragma: no-cache
< Debugrecv: vcl_recv
< Debugrecvreturn: lookup
< debugme: vcl_deliver; desperate8
The entire vcl can be found here: https://gist.github.com/mdemare/2e0fa52e62691806e0a0