Re: [squid-users] Using Squid to replace apache rewrite rule and mod_proxy rewrite rule

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 09 May 2014 06:04:36 +1200

On 9/05/2014 3:21 a.m., Kumar, Amit wrote:
> Hello,
>
> I would like to use "squid" to fetch content on a webpage and also be able to rewrite url's just like Apache. Specifically I would like to selectively proxy a content and selectively rewrite URL.
> Where would be a good point to start on this any quick leads or example would be of great help. I already have a squid server setup and functional.
>
> Apache rewriteRule :
> RewriteRule ^suggest(.*)$ http://bla.bla.bla/suggest$1 [L,NC]

AFAICT this rule is invalid and never matches anything because no URL
can start with 'suggest' like that.

> Apache proxy rule
> RewriteRule ^(.*)$ http://bla.bla.bla/$1 [L,NC, P]
>

This is configured in Squid-3.2+ with:

 acl bla src all
 deny_info http://bla.bla.bla%R bla
 http_access deny bla

However note that context for the lines is significant in both Apache
and Squid. If you have the above embeded in a VirtualHost in Apache then
replace the "src all" in my example with "dstdomain " followed by the
FQDN of that VirtualHost.

Particular to Squid ordering is important. Those lines must be in that
order, and the http_access position relative to all other http_access
determines whether it affects a request or not (they are tested top-down
in a first match wins basis).

Amos
Received on Thu May 08 2014 - 18:04:50 MDT

This archive was generated by hypermail 2.2.0 : Fri May 09 2014 - 12:00:06 MDT