[squid-users] Question about the url rewrite before proxy out

Antony Stone Antony.Stone at squid.open.source.it
Thu Sep 22 08:56:29 UTC 2016


On Thursday 22 Sep 2016 at 06:04, squid-users at filter.luko.org wrote:

> > i am looking for a proxy which can "bounce" the request, which is not a
> > classic proxy.
> > 
> > I want it works in this way.
> > 
> > e.g. a proxy is running a 192.168.1.1
> > and when i want to open http://www.yahoo.com, i just need call
> > http://192.168.1.1/www.yahoo.com the proxy can pickup the the host
> > "http://www.yahoo.com" from the URI, and retrieve the info for me​, so
> > it need to get the new $host from $location, and remove the $host from
> > the $location before proxy pass it. it is doable via squid?
> 
> Yes it is doable (but unusual).  First you need to tell Squid which requests
> should be rewritten, then send them to a rewrite program to be transformed. 
> Identify the domains like this:

<detail snipped>

> If you input http://www.yahoo.com/page.html, this will be transformed to
> http://192.168.1.1/www.google.com/page.html.

I got the impression that the OP wanted the rewrite to work the other way 
around.

Squid sees http://192.168.1.1/www.google.com and  re-writes it to 
http://www.google.com

> The helper just needs to print that out prepended by "OK rewrite-url=xxx". 
> More info at http://www.squid-cache.org/Doc/config/url_rewrite_program/
> 
> Of course, you will need something listening on 192.168.1.1 (Apache, nginx,
> whatever) that can deal with those rewritten requests.

I got the impression that the OP wanted Squid to be listening on this address, 
doing the rewrites, and then fetching from standard origin servers.

> That is an unusual way of getting requests to 192.168.1.1 though, because
> you are effectively putting the hostname component into the URL then sending
> it to a web service and expecting it to deal with that.

Yes, that's what the OP wants Squid to handle, I think.


Antony.

-- 
"640 kilobytes (of RAM) should be enough for anybody."

 - Bill Gates

                                                   Please reply to the list;
                                                         please *don't* CC me.


More information about the squid-users mailing list