url.purge
Pavel Pragin
ppragin at SolutionSet.com
Mon Apr 21 16:43:03 CEST 2008
I tried the whole example it still doesn't work.
Here is my whole vcl file:
backend default {
set backend.host = "127.0.0.1";
set backend.port = "9090";
}
sub vcl_recv {
if (req.request == "GET" && req.url ~
"\.(gif|jpg|swf|css)$") {
lookup;
}
if (req.request != "GET" && req.request != "HEAD") {
pipe;
}
if (req.http.Expect) {
pipe;
}
if (req.http.Authenticate || req.http.Cookie) {
pass;
}
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
}
sub vcl_pipe {
pipe;
}
sub vcl_pass {
pass;
}
sub vcl_hash {
set req.hash += req.url;
set req.hash += req.http.host;
hash;
}
sub vcl_hit {
if (!obj.cacheable) {
pass;
}
deliver;
}
sub vcl_miss {
if (req.http.user-agent ~ "spider") {
error 503 "Not in cache";
}
fetch;
}
sub vcl_fetch {
if (!obj.valid) {
error;
}
if (!obj.cacheable) {
pass;
}
if (obj.http.Set-Cookie) {
pass;
}
insert;
}
sub vcl_deliver {
deliver;
}
sub vcl_timeout {
discard;
}
sub vcl_discard {
discard;
}
acl purge {
"localhost";
}
sub vcl_recv {
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
lookup;
}
}
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged.";
}
}
sub vcl_miss {
if (req.request == "PURGE") {
error 404 "Not in cache.";
}
}
More information about the varnish-misc
mailing list