varnish 3 - odd behaviour with using PURGE against cached objects

Per Buer perbu at varnish-software.com
Wed Aug 14 08:59:33 CEST 2013


Hi Paul,


On Wed, Aug 14, 2013 at 7:56 AM, Paul McInerney <
Paul.McInerney at faredge.com.au> wrote:

> Hi all,****
>
> ** **
>
> I've got varnish currently configured to server cached content for 300
> secs. ****
>
> ** **
>
> I've also allowed varnish to accept purge requests (coming from a trusted
> list of IPs)****
>
> ** **
>
> Watching varnish (using varnishlog), I can see a  PURGE request get
> successfully handled (I am sending the purge via php/curl_init  - even if I
> telnet directly to varnish and issue a direct http request, I still get the
> same 'success')
>
(..)**
>
> Here are the relevant snippets from the default.vcl****
>
> ** **
>
> (..)
>
> sub vcl_hit {****
>
>    if (req.request == "PURGE") {****
>
>     error 200 "Purged.";****
>
>     }****
>
> }****
>
> ** **
>
> sub vcl_miss {****
>
>     if (req.request == "PURGE") {****
>
>     error 404 "Not in cache.";****
>
>   }****
>
> }****
>
> **
>

You need to add purge statements here. Make it look like this:


sub vcl_hit {
        if (req.request == "PURGE") {
                purge;
                error 200 "Purged.";
        }
}

sub vcl_miss {
        if (req.request == "PURGE") {
                purge;
                error 200 "Purged.";
        }
}



-- 
 <http://www.varnish-software.com/> *Per Buer*
CTO | Varnish Software AS
Phone: +47 958 39 117 | Skype: per.buer
We Make Websites Fly!

Winner of the Red Herring Top 100 Europe Award 2013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130814/336dbdcc/attachment.html>


More information about the varnish-misc mailing list