Modify HTML Content with Squid

htmlsquid

We have set up our network as per this tutorial. Basically, we have a squid proxy that inverts images for pages that clients request.

We're trying to modify the script so that we can edit the contents of the webpage before the webpage is sent to the client. We are not having any luck. I'm wondering if there is something different about .html files that makes this not possible.

What is happening is that we do a wget on the URI that is requested, save it locally, modify it and then echo back the new URI. The page that the user gets is the unmodified page and not the one that we just changed.

Best Answer

From the info you've provided, it sounds like you might be best served with something like sqirm. It's a specifically designed program to interact with squid via url_rewrite_program and is probably better than re-inventing the wheel with you're own perl/bash script.

If you still want to do it manually, theres this:

http://www.squid-cache.org/Doc/config/url_rewrite_program/