All, I tried what you suggested, I think it s also a problem on rewrite URI: configuration files: reqrep ^([^\ ]*)\ /kaijiang(/.*) \1\ /result_bbb\2 reqirep ^Host: Host:\ www.bbb.com #reqdeny ^([^\ ]*)\ /kaijiang reqdeny ^([^\ ]*)\ /result_bbb option httpchk GET / HTTP/1.1\r\nHost:\ www.bbb.com server srv_aaa_caipiaos_1_01 www.bbb.com:80 check
The problem show up like : srv_aaa_caipiaos_1_01 20993/0/0/0/20993 404 484 - - ---- 4/4/0/1/0 0/0 "GET /kaijiang HTTP/1.1" and reqdeny is not working , after i changed to #reqdeny ^([^\ ]*)\ /kaijiang, reqdeny works as expected > From: cyril.bo...@free.fr > To: y...@hotmail.com > CC: haproxy@formilux.org; w...@1wt.eu > Subject: Re: Need help about reqrep (urgent) > Date: Sat, 24 Sep 2011 14:35:25 +0200 > > Hi all, > > Le Samedi 24 Septembre 2011 12:43:35 Willy Tarreau a écrit : > > Hi, > > > > On Fri, Sep 23, 2011 at 11:20:52AM +0000, DerekLiao wrote: > > > backend cs_aaa_caipiaos_1 > > > > > > reqrep > > > > > > ^([^\ ]*)\ /kaijiang(/.*) \1\ /result_aaa\2 > > > > > > option httpchk GET / HTTP/1.1\r\nHost:\ www.bbb.com > > > > > > server srv_aaa_caipiaos_1_01 www.bbb.com:80 check > > > > Are you sure that your server does not also consider the Host > > header and refuses to serve /result_aaa from caipiao.aaa.com ? > > I take the thread at the top because for me Willy is right from the beginning. > Your issue is probably not in your reqrep line but because you don't modify > the Host header before sending the request to the remote server (as you do in > your "httpchk" test). > > You should try to add a second reqrep (or reqirep) to change the host : > reqirep ^Host: Host:\ www.bbb.com > > > > when I access caipiao.aaa.com/kaijiang, I get a 404 error, looks like > > > reqrep did not working~ > > And this is probably due to the fact that you try to contact a virtualhost > caipiao.aaa.com on the remote server, which doesn't exist. > > > -- > Cyril Bonté