Thanks, Carlo. It works. But can it be simpler? such as:
frontend http bind :80 mode http default_backend pool backend pool server s01 2.3.4.1:80 server s02 2.3.4.2:80 server s03 2.3.4.3:80 use_server s01 if { src 217.192.7.0/24 } We have many servers for different developers, the rules may be complex and changing. It is not elegant to define hundreds of backend. From: Carlo Flores Date: 2012-03-15 14:45 To: wsq003 CC: haproxy Subject: Re: How to select a server based on client ip ? See the src entry under section 7.5.1 of the HAProxy docs. There's actually many examples of this acl you'll find throughout the doc. You'd use something like this: frontend http bind :80 mode http acl always_s01 src 217.192.7.0/24 use_backend s01 if always_s01 default_backend pool backend s01 server s01 2.3.4.1:80 backend pool server s01 2.3.4.1:80 server s02 2.3.4.2:80 server s03 2.3.4.3:80 On Wed, Mar 14, 2012 at 11:09 PM, wsq003 <wsq...@sina.com> wrote: Hi, If we have 5 servers within a back-end, how can we specify some request to certain server based on client ip? For example: backend server s01 server s02 server s03 server s04 server s05 How can we make all requests comes from 217.192.7.* goes to server s01 ? Thanks.