Re: [squid-users] Old squid redirect

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 05 May 2010 00:38:10 +0000

On Tue, 4 May 2010 18:06:30 +0300, Adam Squids <reversesquid_at_gmail.com>
wrote:
> Hey all,
>
> Using an old Squid 2.5.S10 setup. Trying to redirect mobile
> user-agents to a WAP company that handles the mobile version of my
> site.
> Read a bit about how to do this and got something like :

"like"? or "actual"?

>
> acl Mobile browser -i
>
(^((SO|ha|Se|[m-p]{2})(NIM|ier|ndo|[h-k]{2}a)|(SA|UP|Ph|Er|Bl|So|Mo|po|fr)(MSU|\.Br|ili|ics|ack|nyE|bil|rta|omp)(NG|owse|ps|so|Berr|rics|eExp|lmmm|assc)|(MO|Pa|HT|EZ)(T-|lm|C|OS)|([O-Q][a-d]L\d{2}[a-z]{2}\d+|S(EC|GH|IE)|LG)))|([l-p]{2}[x-z]([(h-m)]|a){4}\/((1\.22)|([45]\.0).*?(ProF|win|pal|we|H|ip|an|sym)(iLE.+m|dows|msou|b|TC_|ho|dr|bia)(IDp|\sce|rce|os|HD\d|ne|oid|n\s*os)))|((q|O|U|SZ)(q|ww|p|O|i)(v|dv|e|ds|OO)(Q|W|R|OO|Z)(V|PP|YY|A).*?\s[k-p](in|OB)[h-j])

Very complex. Could be very easy to break that. Also the -i means case is
ignored.

With the troubles you seem to have understanding Squid. I'd make that a
simple list of lines like these:

acl Mobile browser Nokia
acl Mobile browser Symbian
... etc.

'tis slow to process, but you can optimize _after_ you know if the whole
setup works.

> acl site dstdomain www.MyWebPage.com
> http_access deny site Mobile
> deny_info
>
http://wap.mobilepage.mobi?__h=%{HTTP_HOST}&__p=%{REQUEST_URI}&%{QUERY_STRING}
> Mobile

Squid is not Apache. It does not accept Apache macro language.

  deny_info http://wap.mobilepage.mobi?__h=&__p=%s Mobile

Note how the host name and query string cannot be passed in separately.
%s is the full original URL.

>
> I know that the regex seems odd and insane, but it works (in Apache's
> conf that works / tested great).

Again. Squid is not Apache. They support different expression types.

Working in one does not guarantee working in the other.

>
> Once I did that, nothing from my original configs worked, had to
> rollback and remove that snippet.
>

"nothing"?

Sounds like you are repeating the same habit you showed earlier. Changing
many things, telling us about one and blaming every issue on that one.

> A) How can I make this work with my current 2.5 ? - I also have a
> local Apache that gets requests redirected from Squid, but I rather
> not use it.
> B) I am about to upgrade to Squid 2.7, will that become easier then?
>

For most people. For you I'm not so sure.

Amos
Received on Wed May 05 2010 - 00:38:13 MDT

This archive was generated by hypermail 2.2.0 : Wed May 05 2010 - 12:00:04 MDT