Can Varnish do this?

zabrane Mikael zabrane3 at gmail.com
Wed Jul 7 10:28:30 CEST 2010


Wow guys ;-)
Thanks for all these advices. I'll test them and report any progress.

2010/7/7 Bjørn Ruberg <bjorn at ruberg.no>

> On 07/07/2010 12:10 AM, zabrane Mikael 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.
>>
>>
> Varnish won't be able to search random, arbitrary web sites as you will
> need to predefine all backend. Each external web server will need to be
> defined as its own backend. If the live web requests are limited to a fixed
> number of external sites, you may define each of them in the VCL.
>
> If that is not the case, an elegant solution for your live web requests may
> be installing a regular proxy and define that as one backend; see
> http://ingvar.blog.linpro.no/2010/05/26/accelerating-the-internet-or-actually-squid-with-varnish/for inspiration and details :-)
>
> Then, as others have also explained, you'll define two backends - one
> towards the regular proxy (e.g. Squid) and one towards your web server - and
> then make a VCL rule to define the backend based on whether the "X-RAWDATA"
> header is present or not.
>
> --
> Bjørn
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>



-- 
Regards
Zabrane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.varnish-cache.org/pipermail/varnish-misc/attachments/20100707/8ebbd0e7/attachment-0001.html>


More information about the varnish-misc mailing list