views:

42

answers:

2

Background

I develop a web application that lives on an embedded device. In order to make dev times sane, frontend development is done using apache serving static documents, with PHP proxying out to the embedded device for specifically configured dynamic resources. This requires that we keep various server-simulation scripts hanging around in source control, and it requires updating those scripts whenever we add a new dynamic resource.

Problem

I'd like to invert the logic: if the requested document is available in the static documents directory, serve it; otherwise, proxy the request to the embedded device.

Optimally, I want a software package that will do this for me (for Windows or buildable on cygwin). I can deal with forcing apache to do it with PHP, but I'm unsure how to configure it to make it happen. I've looked at squid and privoxy, but neither of them seem to do what I want.

Any ideas? I'd rather not have to roll my own.

+1  A: 

I think what you want is varnish.

Nick Gerakines
Varnish looks like it will work, in much the same way that apache + PHP would work with the logic inverted. It may be easier to configure / script (from reading the available docs), but as a downside, I have to do manual package management to get its configure script to run because cygwin packages don't appear to use pkg-config. I haven't successfully compiled it yet.
pkh
+1, 'cause looking at varnish got me to the whole 'reverse proxy' idea, which this is a special case of.
pkh
If a reverse proxy is what you are interested in, go checkout perlbal.
Nick Gerakines
A: 

Now that I've looked at varnish, I understand that what I actually want is a special case of a reverse proxy, and that squid can be configured to do what I need. (With the added bonus of having it available as a cygwin package.)

pkh