On Tue, Feb 1, 2011 at 2:06 PM, Raphael Bauduin <[email protected]> wrote: > Hi, > > I would like to apply a reqrep rule only if requests are redirected to > the backup server (my backup server is running a very simple http > server that cannot handle rewrites and I want all requests to return > /index.html). > Is there a way to achieve this?
Fore the record, in case anyone asks the same question, here's the solution: define an acl based on the number of servers available, and only do the rewrite if the number of servers available is equal to zero. I ended up with this config: backend app_servers balance roundrobin option redispatch option httpclose option forwardfor option httplog option httpchk OPTIONS / server biff 10.12.13.176:80 weight 16 maxconn 16 check inter 10s server mainappserver 10.12.13.127:80 weight 16 maxconn 16 check inter 10s acl maintenance_mode nbsrv eq 0 reqrep ^([^\ ]*)\ /([^\ ]*)\ (.*) \1\ /\ \3 if maintenance_mode server static-backup 10.12.13.14:2001 backup Raph > > Here's the relevant part of my config file. the problem here is that > all requests are send to / on the backend server, even the production > servers..... > > backend app_servers > balance roundrobin > option redispatch > option httpclose > option forwardfor > option httplog > option httpchk OPTIONS / > server mainappserver 10.12.13.172:80 weight 16 maxconn 16 check > inter 10s > reqrep ^([^\ ]*)\ /([^\ ]*)\ (.*) \1\ /\ \3 > server static-backup 10.12.13.14:2001 backup > > Thanks > > Raph > > -- > Web database: http://www.myowndb.com > Free Software Developers Meeting: http://www.fosdem.org > -- Web database: http://www.myowndb.com Free Software Developers Meeting: http://www.fosdem.org

