rewrite cgi get uri http requests with squid

Some sites uses uris like: "http://domain/out.cgi?uri=http://real.net/uri.html".

This squid rewrite script redirects you directly to the real uri.

What you need

A running squid proxy and perl.

How to install

Make a new directory and download and extract the script into it.

Tell squid about the rewrite script. Search in the "squid.conf" file for "url_rewrite_program" and point it to this rewrite script.

Example:

url_rewrite_program /home/ralf/squid/rewrite-url.pl

Configuration

Client access is controlled by the "rewrite-url-clients.cfg" file.
Put every ip address that should make use of the rewriting into that file.
One IP per line.
Requests from clients which are not in the file are not rewritten and still using the default behavior.

Example:

192.168.0.1
127.0.0.1
192.168.0.5

Domains which should be used for rewriting are in the "rewrite-url-domains.cfg" file.
One domain per line.

Example:

www.this-domain.com
other-domain.net

Every line in a config file can be commented by prefixing a "#".

After changing something tell squid to reload by using: "killall -HUP squid".

Know Bugs

At the moment the request uri must match the regex: "u(?:urls?)=", which searches in the GET parameter for "u=..", "url=.." and "urls=..".

Contact / Questions / Bug Reports / Feature Requests / SPAM

ralf@stormbind.net.

Version history

2007-08-11