because you return deliver, you are bypassing the builtin.vcl section that usually calls synthetic() ( https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/builtin.vcl#L113), that is why you have a 0-length body.
Also, the "Invalidated..." message is the reason (like the "OK" for a 200), not the body. Check the response line of your response (i.e. the first line, before the headers) -- Guillaume Quintard On Thu, Aug 29, 2019 at 11:38 AM Tim Kelty <[email protected]> wrote: > 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 >
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
