vcl to avoid caching 404
Jonathan Leibiusky
ionathan at gmail.com
Tue Apr 5 17:20:03 CEST 2011
Hi!
I am trying to configure varnish to avoid caching some specific http
statuses sent from the backend. Since I can't control 100% the headers they
are sending, I should do it in varnish as they all go through it.
What I came with is:
sub vcl_fetch {
if (obj.status == 404 || obj.status == 503 || obj.status == 500) {
set obj.http.Cache-Control = "max-age=0";
return (pass);
}
return (deliver);
}
But when I try to run varnish it complains about not being able to compile
vcl:
Message from VCC-compiler:
Variable 'obj.status' not accessible in method 'vcl_fetch'.
At: (input Line 80 Pos 9)
if (obj.status == 404 || obj.status == 503 || obj.status == 500) {
--------##########----------------------------------------------------
Running VCC-compiler failed, exit 1
VCL compilation failed
I saw in the documentation that obj.status is valid.
What I am doing wrong?
I am using varnish-2.1.3
Thanks!
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110405/ba554655/attachment-0003.html>
More information about the varnish-misc
mailing list