Mailing List Archive

VCL and Non-Existent Backend Objects
Hey,

I was contemplating a setup such as this:

1) Client requests xml file from varnish cache
2) If it exists, fine; else check backend file server running lighttpd
3) If it exists on the backend, again no problem; however, if it doesn't
exist on the lighttpd backend, I need varnish to check another (dynamic)
backend, which will dynamically generate it and save it on the lightttpd
backend for future purposes.

Does anyone have any ideas on how to implement that via VCL? I would
imagine I would need to be able to see the response headers from the
original backend, to see if a 404 is generated (like here
http://varnish.projects.linpro.no/ticket/88).

Thanks!
-- james
VCL and Non-Existent Backend Objects [ In reply to ]
James Quacinella <james at nyi.net> writes:
> I was contemplating a setup such as this:
>
> 1) Client requests xml file from varnish cache
> 2) If it exists, fine; else check backend file server running lighttpd
> 3) If it exists on the backend, again no problem; however, if it
> doesn't exist on the lighttpd backend, I need varnish to check another
> (dynamic) backend, which will dynamically generate it and save it on
> the lightttpd backend for future purposes.
>
> Does anyone have any ideas on how to implement that via VCL? I would
> imagine I would need to be able to see the response headers from the
> original backend, to see if a 404 is generated (like here
> http://varnish.projects.linpro.no/ticket/88).

I don't think this is supported in the current code base. Poul-Henning
and I discussed something similar on Monday - the ability to restart a
request, possibly after modifying it a little.

There was also some talk at some point of adding some kind of "policy
check" functionality - the ability to perform a secondary HTTP request
from VCL code, e.g. to check a user's credentials before serving a
cached document which requires authorization, rather than just passing
the entire request on to the backend.

Mind you, these are just ideas - we have no concrete plans to implement
any of this in the near future. We are currently ramping up work on
2.0, and will most likely be busy with that until fall.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
VCL and Non-Existent Backend Objects [ In reply to ]
On May 11, 2007, at 1:55 AM, Dag-Erling Sm?rgrav wrote:

> There was also some talk at some point of adding some kind of "policy
> check" functionality - the ability to perform a secondary HTTP request
> from VCL code, e.g. to check a user's credentials before serving a
> cached document which requires authorization, rather than just passing
> the entire request on to the backend.

Perlbal does this by having the first backend return a special
"reproxy" header that Perlbal then uses to do the request again to
another backend.

http://lists.danga.com/pipermail/perlbal/2007-May/000441.html
http://code.sixapart.com/svn/perlbal/trunk/doc/reproxying.txt



- ask

--
http://develooper.com/ - http://askask.com/
VCL and Non-Existent Backend Objects [ In reply to ]
Ask Bj?rn Hansen wrote:
>
> On May 11, 2007, at 1:55 AM, Dag-Erling Sm?rgrav wrote:
>
>> There was also some talk at some point of adding some kind of "policy
>> check" functionality - the ability to perform a secondary HTTP request
>> from VCL code, e.g. to check a user's credentials before serving a
>> cached document which requires authorization, rather than just passing
>> the entire request on to the backend.
>
> Perlbal does this by having the first backend return a special
> "reproxy" header that Perlbal then uses to do the request again to
> another backend.

Thats pretty neat. Too bad the LB software I'm using doesn't really
support that (at least not now).

-- james