On Fri, Jan 26, 2018 at 2:36 AM, Pieter Vogelaar <[email protected]> wrote:
> It’s TCP layer 4 load balancing, so the HTTP hdr(host) won’t work. > > > > > > Best regards, > > Pieter Vogelaar > > > > *Van: *Igor Cicimov <[email protected]> > *Datum: *donderdag 25 januari 2018 om 16:33 > *Aan: *Pieter Vogelaar <[email protected]> > *CC: *"[email protected]" <[email protected]> > *Onderwerp: *Re: How can I map bindings to the correct backend? > > > > Hi Pieter, > > > > On Thu, Jan 25, 2018 at 3:15 AM, Pieter Vogelaar <[email protected]> > wrote: > > I have the following configuration: > > > > > > frontend default-tcp > > bind 192.168.52.12:5044 > > bind 192.168.52.12:5555 > > bind 192.168.52.12:5556 > > bind 192.168.52.12:5672 > > bind 192.168.52.13:5672 > > mode tcp > > option tcplog > > use_backend %[dst_port,map(/etc/haproxy/tcp-bindings-to-backends.map, > default)] > > > > > > The map file (/etc/haproxy/tcp-bindings-to-backends.map) looks like: > > > > > > 192.168.52.12:5044 logging-logstashmsg-acc > > 192.168.52.12:5555 logging-logstashmsg-acc > > 192.168.52.12:5556 logging-logstashmsg-acc > > 192.168.52.12:5672 logging-rabbitmq-acc > > 192.168.52.13:5672 stackstorm-rabbitmq-tst > > > > > > I would like to route based on the IP address and port to the correct > backend. At the moment I used the dst_port sample on the use_backend line. > But that must be a concatenation of dst sample, “:” and dst_port sample. > > It seems like a basic thing to do, but I just can’t figure out how to do > this. > > > > > > How do you access the frontend? If via ip:port instead of dns than I > guess the ip:port combo will already be present in the hdr(host). > > > Right, tcp didn't notice that.

