HAProxy community

Multiple use_backend with with different map

Hi,
I am trying to have multiple map files used in the same frontend like:

  use_backend %[req.hdr(host),lower,map(/etc/haproxy/web-dom2back.map)]
  use_backend %[req.hdr(host),lower,map(/etc/haproxy/web-dom1back.map)]

But what happens is that when I try to access a website that is defined in web-dom1back.map it doesn’t work because it is not found on the first map and then defaults to something else.

What options do I have here? I just would like to have this setup to have better organized the maps with shorter files.

Thanks.

Hi,

I had the same issue, and putting the if statement at the end of each line (as per Using use_backend rules with map files) resolved my problem.

1 Like

you are right, I was missing the conditional.

Cheers.