HAPROXY: multiple domains, multiple ports, multiple server

Viewed 261

I have two domains (abc.com, xyz.com), four ports (443, 8080, 80, 3000) and three servers (10.147.19.1, 10.147.19.2, 10.147.19.4). I want to set up the Haproxy to achieve these type of routes:

abc.com:443     ---> 10.147.19.1:80
abc.com:8080    ---> 10.147.19.2:3000
xyz.com:443     ---> 10.147.19.1:80
xyz.com:8080    ---> 10.147.19.4:3000

From the docs, I can bind front end with Haproxy Maps. So I tried to bind port 443 with maps.

frontend port_443
        bind *:443
        use_backend %[req.hdr(host),lower,map_dom(/etc/haproxy/maps/port_443.map,be_default)]

Here is the map

# Domain    backend
  abc.com   be_1
  xyz.com   be_1

The question, how to define the backend with the right ports? Please help!

0 Answers
Related