title: HAPROXY: multiple domains, multiple ports, multiple server
body: <p>I have two domains (<code>abc.com</code>, <code>xyz.com</code>), four ports (<code>443</code>, <code>8080</code>, <code>80</code>, <code>3000</code>) and three servers (<code>10.147.19.1</code>, <code>10.147.19.2</code>, <code>10.147.19.4</code>).
  I want to set up the Haproxy to achieve these type of routes:</p>
  <pre><code>abc.com:443     ---&gt; 10.147.19.1:80
  abc.com:8080    ---&gt; 10.147.19.2:3000
  xyz.com:443     ---&gt; 10.147.19.1:80
  xyz.com:8080    ---&gt; 10.147.19.4:3000
  </code></pre>
  <p>From the docs, I can bind front end with Haproxy Maps. So I tried to bind port 443 with maps.</p>
  <pre><code>frontend port_443
          bind *:443
          use_backend %[req.hdr(host),lower,map_dom(/etc/haproxy/maps/port_443.map,be_default)]
  </code></pre>
  <p>Here is the map</p>
  <pre><code># Domain    backend
    abc.com   be_1
    xyz.com   be_1
  </code></pre>
  <p>The question, how to define the backend with the right ports? Please help!</p>