Within my vcl_recv, I have something like this:

# Allow purging
if (req.method == "PURGE") {
if (!client.ip ~ purge) {
return (synth(403, "Forbidden"));
}

if (req.http.xkey-purge) {
set req.http.n-gone = xkey.purge(req.http.xkey-purge);
# If you got this stage (and didn't error out above), purge the cached result
return (synth(200, "Invalidated "+req.http.n-gone+" objects"));
} else {
return (purge);
}

}

…and a a vcl_synth like:

sub vcl_synth {
if (resp.status == 720) {
# We use this special error status 720 to force redirects with 301 (permanent) 
redirects
# To use this, call the following from anywhere in vcl_recv: return (synth(720, 
"http://host/new.html";));
set resp.http.Location = resp.reason;
set resp.status = 301;
return (deliver);
} elseif (resp.status == 721) {
# And we use error status 721 to force redirects with a 302 (temporary) redirect
# To use this, call the following from anywhere in vcl_recv: return (synth(720, 
"http://host/new.html";));
set resp.http.Location = resp.reason;
set resp.status = 302;
return (deliver);
}

return (deliver);
}


When I perform the xkey-purge request, I get back a 200, and can confirm that 
the purging is working, but the content-length is always 0 (I don't get the 
"Invalidated n objects" message).

Not sure where to start debugging…any idea what could cause this?

—
Tim Kelty
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to