HAProxy IP vs. host routing

Discussion in 'HOWTO-Related Questions' started by Franck, Jun 18, 2009.

  1. Franck

    Franck New Member

    I have followed the high availability/load balancer tutorial, works like a charm thanks! :)

    Problem is that I have several vhost on the backend server and HAproxy always routes to the default (in my case first) one.

    On the load balancers I have in etc/hots

    http1.example.com 192.168.0.102 # where192.168.0.102 is the server with mutiple vhost

    I have tried in HAPROXY.cfg

    server webA http1.example.com:80 cookie A check

    But it still routes me to the wrong vhost (as if it was routing directly to 192.168.0.102 and not to http1.example.com)

    Any idea?

    Thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. Franck

    Franck New Member

    Thanks for the prompt reply falko. Actually I solved the problem by thinking about it a bit longer :)

    Essentially HAProxy balances nodes only (regardless of domain) so I ended up putting the same vhost on node 1 and node 2!

    My HAProxy conf is as per your tutorial and on node1/node2 I have the same

    <VirtualHost *:80>
    ServerName http.ndd.com
    ...
    </VirtualHost>

    Instead of having previously http1.ndd.com on node1 and http2.ndd.com on node 2 (which btw is the setting one should use when using apache mode_balancer)
     

Share This Page