views:

245

answers:

4

Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client?

As an example:

Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages of pdf, watermarked pdf is returned to client.

Regards, Mike

A: 

I've had success with Pound.

Andrew Edgecombe
+1  A: 

Apache has mod_proxy and mod_proxy_html, which is used to rewrite links, headers, etc. I've only ever seen HTML or XML filters, but you should be able to write your own binary one for your PDF needs. The possible difficulty I could see is that Apache treats webpages as a stream, rather than a file. I'm not sure how to watermark a PDF doc, but if you need access to the entire file to do it, it might get complicated quickly.

Note that it would seem far easier to me to do the watermarking on the server, where you have access to the file, rather than a proxy. If server load is a concern, either a batch process, or a separate server could be an alternative solution.

Mark Brackett
A: 

I think I might go down the Squid/ICAP route.

This is for an enterprise level system, does anyone have any experience with either of these in this context?

http://wiki.squid-cache.org/Features/ICAP

Mike K
A: 

I found a description of Deliverance over on the python tags, and it may be useful for what you're looking for. I have no experience with it myself, so grain of salt and all that.

http://www.openplans.org/projects/deliverance/introduction

Jack M.