purge_url

Dag-Erling Smørgrav des at linpro.no
Tue Jan 8 16:42:55 CET 2008


Erik <duja at torlen.net> writes:
> [redacted]
>
> sub vcl_recv {
>         if (req.http.host == "10.1.1.54" || req.http.host == "test.mysite.com") {
>                 set req.http.host = "www.mysite.com";
>         }
>
>         if (req.request == "PURGE") {
>                 if (client.ip ~ purge) {
>                         purge_url(req.url);
>                 }
>         }
> }
>
> sub vcl_miss {
>         if (req.request == "PURGE") {
>                 error 404 "The url could not be found in the cache.";
>         }
> }
>
> sub vcl_hit {
>         if (req.request == "PURGE") {
>                 set obj.ttl = 0s;
>                 error 200 "Purged successfully!";
>         }
> }

You are mixing two different purge mechanisms.  I think what you want
is listed in the EXAMPLES section in the vcl(7) manual page.

Also, the PURGE request you showed did not include a Host: header at
all, so your host normalization code never kicked in, and you tried to
purge a different document from the one you later requested.

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no



More information about the varnish-misc mailing list