Multiple Profiles of Configuration for BE/FE


One question:

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


-> 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?



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.

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

backend be1
  server fe1 

backend be2
  server fe2

frontend fe1
  default_backend myapp1

frontend fe2
  default_backend myapp2

backend myapp1
  server srv1 xxxxx

backend myapp2
  server srv1 xxxxx