How PURGE works

Souvik Bhattacharya souvikbhattacharyas at gmail.com
Thu Mar 14 08:39:01 CET 2013


Hi,
    I am new to Varnish and during cache invalidation I have a confusion.

a) As per the guide line when I will write 'purge' content management
system send a special HTTP request to Varnish. So, is this request sending
done automatically or my own program need to send a request with
request.method ='PURGE'

b) In the below program to purge a object VCL check is the request is with
'PURGE'. But if I am initiating purge for the first time then how the
req.request will be 'PURGE'?

sub vcl_recv {
        if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                        error 405 "Not allowed.";
                }
                return (lookup);
        }
}

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

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


Please help me to understand the same or if you have any better view please
share the same.
-- 
Thanks & Regards,

Souvik Bhattacharya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130314/26f064d8/attachment-0001.html>


More information about the varnish-misc mailing list