Le jeudi 16 décembre 2010 06:21:08, Shawn Heisey a écrit :
> On 12/15/2010 9:20 PM, Shawn Heisey wrote:
> > On 12/15/2010 7:50 PM, Cyril Bonté wrote:
> >> This configuration
> >> should work (fixed the acl and merged all the reqirep in the
> >
> >> frontend) :
> > The things that match /foo* can't use the tomcat backend, they have to
> > use the apache backend. Everything that doesn't match an ACL uses the
> > tomcat backend, which is not really tomcat, it's still apache - but
> > apache sends it through to tomcat, thus the name. The /foo* paths are
> > sent to the CGI, hosted by apache. If we can make it work, I do plan
> > eventually to put the actual tomcat server ports in the tomcat backend.
Yes, this is how this configuration works.
Example :
Incoming request is : GET /fooc/bar HTTP/1.1
=> APPLYING reqirep ^([^\ ]*)\ /fooc/(.*) \1\ /cgi-bin/cgi-
gw.exe?action=capt&fooid=\2
The request becomes : GET /cgi-bin/cgi-gw.exe?action=capt&fooid=bar HTTP/1.1
It won't match the 'fooc' acl anymore but the 'cgi' one will.
And you've got :
use_backend apache if cgi
which sends the request to the apache backend.
> Perhaps what doesn't work in my first attempt is having more than one
> thing happen if an ACL matches. To put everything into the frontend, I
> need to use a config like this, to have it both rewrite the request and
> send it to a nondefault backend:
>
> reqirep ^([^\ ]*)\ /fooc/(.*) \1\
> /cgi-bin/cgi-gw.exe?action=capt&fooid=\2 if fooc
> use_backend apache if fooc
>
> I'm guessing that it works like a Cisco access-list - the first entry
> that matches determines the outcome, the rest of the entries are
> ignored. If I'm right, then it would probably work if I put all the
> reqirep statements in the backend, where they wouldn't need acl conditions.
ACL are re-evaluated each time a condition is met. This is why "use_backend
apache if fooc" can't match after "reqirep" (I missed these lines in your
first example, sorry).
--
Cyril Bonté