in reply to Pass through perl http proxy server (no code, just advice)
not Perl and a heavyweight (functionwise, not necessarily slow/bloated) is Squid Web Proxy Cache which you could probably make do whatever you can imagine.