Re: [squid-users] How about location_rewrite in Squid 3.1?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 22 Sep 2009 22:45:51 +1200

Liu Ming wrote:
> Hi,
>
> So "location_rewrite_*" will not be useful until 3.2? I hope it will not
> be too long to make my boss fire me :-)

I did not say that. :) you can always patch Squid yourself or have
someone do it for you.

3.2 is available _now_ if you don't mind running alpha quality code that
_will_ change. Any work done towards porting this feature will go in
there and be usable soon after acceptance.

>
> Could I example my problem more ? maybe you or someone can help me for this:
> 1) user === www.a.com <http://www.a.com> ===> squid server
> 2) squid server know www.a.com <http://www.a.com> is another name of
> www.b.com <http://www.b.com>, so it request www.b.com
> <http://www.b.com> for caching
> 3) squid server === www.b.com <http://www.b.com> ===> www.b.com
> <http://www.b.com> server
> 4) www.b.com <http://www.b.com> server receive request of www.b.com
> <http://www.b.com> and then he want user to rediect to
> www.b.com/beta/index.html <http://www.b.com/beta/index.html>
> 5) www.b.com <http://www.b.com> === redirect message ===> squid server
> 6) squid server === redirect message ===> user
> 7) user redirect to www.b.com/beta/index.html
> <http://www.b.com/beta/index.html> (PROBLEM!!!, it should be changed to
> www.a.com/beta/index.html <http://www.a.com/beta/index.html>)
>
> what we want is the redirect message can be changed to
> www.a.com/beta/index.html <http://www.a.com/beta/index.html>, so user
> can still use our squid caching. How can I do ?

Hmm, I've been considering a relatively minor change to deny_info that
will clean this up, but its not ready yet either :(

There are a few ways to do it in all squid:

  - The one most people seem to like is a url_rewrite_program helper

  - The 'proper' HTTP-based way to do it is this:

  acl httpSafeRedirectA dstdomain www.a.com
  deny_info http://www.b.com httpSafeRedirectA
  http_acecss deny httpSafeRedirectA

... the problem there is that sub-page requests get redirected to the
root of the alternate domain.

So you will need a 'catcher' script to do a second redirect

  deny_info http://www.b.com/foo.cgi?%s httpSafeRedirectA

script does:
   www.a.com/foo.cgi?http://www.b.com/beta/index.html ->
    (301 permanent move) -> www.a.com/beta/index.html

I'm working right now on a patch that will resolve the extra config
hassle and scripting.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE7 or 3.0.STABLE19
   Current Beta Squid 3.1.0.13
Received on Tue Sep 22 2009 - 10:45:59 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 22 2009 - 12:00:02 MDT