Can Varnish do this?

Angelo Höngens A.Hongens at
Wed Jul 7 08:10:25 CEST 2010

> On Wed, Jul 7, 2010 at 12:10 AM, zabrane Mikael <zabrane3 at>
> wrote:
> > Hi List,
> > I'm new to Varnish, so please apologize if the question was already
> asked
> > before.
> > I've a homemade web server running on my intranet. It works like
> this:
> > 1. If an HTTP request arrives without a special header "X-RAWDATA:
> ...",
> > this web server forward the request to the live Web, get the
> response, and
> > send it back (i.e it plays a role of a basic proxy).
> > 2. Now, if a request contains the special header "X-RAWDATA: ...",
> then the
> > web server will search the response in
> > its internal database (complex computations), and send it back.
> > Point 2 works very very well. But not point 1 as my web server isn't
> a true
> > HTTP proxy.
> > So, my question is simple:
> > Could I tell Varnish to inspect the HTTP headers, and decide:
> > a. If the special header "X-RAWDATA: ..." doesn't exists, let the
> request go
> > to the live Web directly.
> > b. Otherwise, forward the request to my web server.
> > Hope I'm clear guys.
> > Thanks in advance.

So basically what you want to do is define two backends, and if your custom header is present in the request, you want it to go to one backend, and if not, you want to go to the other backend.

I'm not a varnish guru, but I think it should be possible quite easily. I googled, and this page shows you can do something with custom headers:


More information about the varnish-misc mailing list