[varnish] Defining varnish + proposals for the FAQ page

Poul-Henning Kamp phk at phk.freebsd.dk
Fri Nov 23 22:09:14 CET 2007

In message <53C652A09719C54DA24741D0157CB2695FF9C0 at TFPRDEXS1.tf1.groupetf1.fr>,
 "BUSTARRET, Jean-francois" writes:

>How do I configure varnish to act like a classical reverse proxy ? [new]
>Here is a sample VCL to do this :

There is one aspect of VCL that I need to communicate better:  You
don't need to copy the default VCL into your vcl files.

The way the compiler works is that all definitions of each function
are concatenated, and the default function comes last.

So if for instance you only write in your VCL code:

	sub vcl_recv {
		if (req.url ~ "[.]exe") {
			error 500 "bugger off";

the compiler will append to this, the default vcl code for vcl_recv.

All the piping/passing of stuff will happen automatically don't
need to put that code in there.

The reason I have written the compiler this way, is so that users
would only need their own specific code.

That way, the default code can change without annoying the users
along the way.

But if you as a user, include the entire default code in your VCL
program, you will have to integrate, by hand, any subsequent
changes to the default VCL code yourself.

Also, if you want to make varnish behave as much as a RFC2616 proxy
as it can, you do not need a VCL program at all, that is, more or
less exactly, what the default VCL code is written against: The
Principle Of Least Astonishment.


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