Problem with pass in vcl_fetch
Connor Walls
connor.walls at skillpages.com
Tue Aug 9 11:40:13 CEST 2011
Hi,
I’m trying to configure vcl_fetch for a particular scenario. In certain situations, say a particular aspect of a page fails to render correctly and we don’t want this to be cached in varnish, the backend server is appending a particular header to the response, in this case “X-SP-NoCache: yes”. In vcl_fetch I am then checking for this header, and switching to pass mode. The problem is, when the header is then removed from that page, it still continues to pass it instead of delivering it (it doesn’t get inserted into the cache). It goes as follows (assuming a new varnish instance has just been started):
Action X-SP-NoCache X-Cache (set in vcl_deliver)
Browser to Url yes Miss
Refresh page yes Miss
Change X-SP-NoCache header no Miss
Refresh page no Miss
Purge page with varnishadm no Miss
Refresh page no Hit
The vcl_fetch function looks as follows:
Sub vcl_fetch {
If (beresp.http.X-SP-NoCache ~ “(?i)yes”) {
Return (pass);
}
//Other code is included in here, passes control to deliver or pass depending on other criteria
}
The thing that’s confusing me, and that’s leading me to believe it isn’t my vcl code that’s the problem, is that flushing the cache is fixing the issue. I don’t understand how flushing the cache can affect the behaviour of any page which isn’t currently stored in the cache? I’m running varnish-2.1.3 if that’s relevant. Any help would be greatly appreciated.
Thanks,
Connor Walls
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110809/0750380f/attachment-0003.html>
More information about the varnish-misc
mailing list