VCL config file for specific URLs

Poul-Henning Kamp phk at
Sat Jan 9 11:49:13 CET 2010

In message <4c3149fb1001090240l53a26f5eg9452abdbdd820d45 at>, pub c
rawler writes:

>Any idea of how to accomplish the cache exception of these handful of pages?

If you have a short-ish list of URLs, you can simply test for them:

	sub vcl_recv {
		if (req.url ~ "(foo.html|bar.html|baz.html)") {

If the list is long-ish, consider having the webserver mark them
as non-cacheable by adding a HTTP header varnish can check for
instead.  That way the knowledge about cacheability is maintained
with the content.

Of course, you can also mix the two methods...

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-misc mailing list