Worlds first "real world" VCL program

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Aug 23 13:46:20 CEST 2006


Implementing PURGE in squid style:


	acl purge {
		"localhost";
		"10.0.0.1";
	}

	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.";
		}
	}

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-dev mailing list