Re: URL rewriting

From: Shawn Heisey <haproxy#elyograg.org>
Date: Wed, 15 Dec 2010 07:17:56 -0700


I'm on a roll, let's continue the schizophrenia. :) I'd still like to know if there's a way to streamline the config, but I am likely to find that management likes the ability to track the separate backends on the stats page.

Shawn

On 12/15/2010 7:01 AM, Shawn Heisey wrote:
> I get the feeling that I am talking to myself, but that's OK.
>
> This is finally working, but I'm not happy with the way the config
> turned out. Last night, I commented out all but one of the reqirep
> statements. That one statement by itself was working. That gave me
> an idea, and so I created a separate backend for each ACL, and put one
> reqirep in each one.
>
> This makes it look like I can't have more than one reqirep in the
> frontend. Can I put them all in a single backend? I don't like all
> the duplication my current config has. Here is the config, with the
> critical identifier changed to "foo" throughout:
>
> frontend foo *:80
> acl bot hdr(user-agent) -i ia_archiver jeeves googlebot
> mediapartners-google msnbot slurp zyborg
> acl foo path_beg -i /foo/
> acl fooc path_beg -i /fooc/
> acl fooh path_beg -i /fooh/
> acl foothumb path_beg -i /foothumb/
> acl featured path_beg -i /featured/foothumbnew/
> acl cgi path_beg -i /cgi-bin/cgi-gw.exe
>
> use_backend apache_fooh if bot fooh
> use_backend apache_foo if foo
> use_backend apache_fooc if fooc
> use_backend apache_foothumb if foothumb
> use_backend apache_featured if featured
> use_backend apache if cgi
> default_backend tomcat
>
> backend tomcat
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 backup check
>
> backend apache
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
>
> backend apache_foo
> reqirep ^([^\ ]*)\ /foo/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=webres&fooid=\2
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
>
> backend apache_fooh
> reqirep ^([^\ ]*)\ /fooh/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=autodetails&fooid=\2
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
>
> backend apache_fooc
> reqirep ^([^\ ]*)\ /fooc/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=capt&fooid=\2
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
>
> backend apache_foothumb
> reqirep ^([^\ ]*)\ /foothumb/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=thumbres&fooid=\2
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
>
> backend apache_featured
> reqirep ^([^\ ]*)\ /featured/foothumbnew/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=thumbreshigh&fooid=\2
> balance leastconn
> server server8080 10.10.14.127:8080 check
> server server8081 10.10.14.127:8081 check
Received on 2010/12/15 15:17

This archive was generated by hypermail 2.2.0 : 2010/12/15 15:30 CET