I'm looking for a way to script a transparent forward proxy such as the ones that users point their browsers to in proxy settings.

I've discovered a distinct tradeoff in forward proxies between scriptability and robustness. For example, their are countless proxies developed in [Ruby](http://github.com/whymirror/mousehole) and [Python](http://proxies.xhaus.com/python/) that allow you to inspect each request response and log, modify, filter at will ... however these either fail to proxy everything needed or crash after 20 minutes of use.

On the other hand I suspect that Squid and Apache are quite robust and stable, however for the life of me I can't determine how I can develop dynamic behavior through scripting. Ultimately I would like to set quota's and dynamically filter on that quota. Part of me feels like mixing [mod\_proxy](http://httpd.apache.org/docs/1.3/mod/mod_proxy.html) and mod\_perl?? could allow interesting dynamic proxies, but its hard to know where to begin and know if its even possible.

Please advise.