Commit 17323a3d authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Add an example based on VG's PURGE code.

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1149 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent dd8e5908
......@@ -34,8 +34,6 @@
.Sh NAME
.Nm VCL
.Nd Varnish Configuration Language
.Sh SYNOPSIS
.\" ...
.Sh DESCRIPTION
The
.Nm
......@@ -278,6 +276,37 @@ sub vcl_fetch {
}
}
.Ed
.Pp
The following code implements the HTTP PURGE method as used by Squid
for object invalidation:
.Bd -literal -offset 4n
acl purge {
"localhost";
"10.0.0.1"/8;
}
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.";
}
}
.Ed
.Sh SEE ALSO
.Xr varnishd 1
.Sh HISTORY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment