Re: [squid-users] Reverse proxy with URL rewriting

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Wed, 30 Apr 2008 12:39:39 +0200

tor 2008-05-01 klockan 00:34 +0200 skrev Sylvain Beaux:

> I read in FAQ that I need to use a external script/program which modify
> "on-the-fly" URLs.

Yes.

> But is there other possibilities to rewrite URL, I meen squid native
> possibilities ?

There is some built-in rewrite capability in the upcoming 2.7 release.

But it's quite trivial to make the needed helper. A simple 2 line perl
program does it nicely.. (add one line per rewrite)

#!/usr/bin/perl -p
BEGIN { $|=1; }
s%^http://www1.example.com%http://intranet.example.com/www1% && next;

But be warned that the web server in this kind of setup doesn't realize
that the externally requested URL is quite different from it's own view
of the URL and this will cause problems for any absolute urls found in
the content, and on redirections sent by the web server such as when you
request a folder without the traling /

> The problem is that we have to implement different scripts if we use a
> linux or a NT system so we can't be agnostic from the OS.

Perl runs fine on both...

Regards
Henrik
Received on Wed Apr 30 2008 - 10:40:28 MDT

This archive was generated by hypermail 2.2.0 : Thu May 01 2008 - 12:00:04 MDT