Time for action – writing a simple URL redirector program
Let's see a very simple Perl script that can act as a URL redirector program.
$|=1; while (<>) { s@http://www.example.com@303:http://www.example.net@; print; }
The previous code is a URL redirector program in its simplest form. It redirects all URLs containing the URL www.example.com
to www.example.net
without inspecting values of any of the fields by Squid.
What just happened?
We have just seen a simplistic Perl script which can act as a URL redirector program and can be used with Squid.
Have a go hero – modify the redirector program
Modify the previous URL redirector program so that all requests to google.co.uk
can be redirected to google.com
.
Concurrency
We can make our URL redirector programs ...
Get Squid Proxy Server 3.1 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.