purge_url

Anders Nordby anders at fupp.net
Tue Dec 18 00:54:18 CET 2007


On Thu, Dec 13, 2007 at 12:02:38PM +0100, Erik wrote:
> I will stop bothering the helpful guys at the irc for a minute and ask a question here ;) 
> 
> My VCL conf looks like this:
> sub vcl_recv {
>         #Change the host header to www.mysite.com
>         if(req.http.host == "10.1.1.54" || req.http.host == "test.mysite.com") {
>                 set req.http.host = "www.mysite.com";
>         }
> 
>         #Purge specified files from acl purge.
>         #Purge = Delete the specified url from the cache
>         if(req.request == "PURGE") {
>                 if(client.ip ~ purge) {
>                         purge_url(req.url);
>                 }
>         }

I would change this part to:

	if(req.request == "REPURGE") {
		if(client.ip ~ purge) {
			purge_url(req.url);
			error 200 "Repurged."
		}
	}

If you are sending a regexp purge, you will always get a miss, unless
you accidentally don't use any regexp special characters - which does
not make sence. In any case, I recommend using a different request for
normal purge and regexp purge, but supporting both in the VCL.

Bye,

-- 
Anders.



More information about the varnish-misc mailing list