Multiple Profiles of Configuration for BE/FE


#1

One question:

Is haproxy capable of working with multiple frontend/backand profiles?

Example:

-> if the request is from the network 192.168.1.X it sends to the configurations of frontendX / backendX;

-> And if the requests are from the 192.168.1.Y network, then it directs to the frontendY / backendY configurations.

Can you do that?


#2

Hi,

Nope, HAProxy can’t do that.
The best for you is to chain 2 set of FE / BE: the first FE does the routing to a BE based on client IP. This BE points to your application FE with your own settings.
IE:

frontend myapp
  use-backend be1 if { src 192.168.1.X }
  use-backend be2 if { src 192.168.1.Y }

backend be1
  server fe1 127.0.0.1:81 

backend be2
  server fe2 127.0.0.1:82


frontend fe1
  default_backend myapp1

frontend fe2
  default_backend myapp2

backend myapp1
  server srv1 xxxxx

backend myapp2
  server srv1 xxxxx