Haproxy -> 1:1 mapping domain to server

  • Trying to work out simple task (I think).

    I've tried searching the forum and the world wide web… and as fare as I can find, haproxy will solve all my problems.
    But I can't seem to get it to work the way I want. As I understand haproxy is mostly used for load balancing, but can also work for my setup.

    Basically I have only one WAN ip, with two different web server (at the moment).
    I'm also hosting a couple of domains, and I want them to go to different server.

    foo.domain1.com --> local_webserver1
    bar.domain2.com --> local_webserver1

    domain3.com --> local_webserver2
    domain4.com --> local_webserver2

    Why I want this, is because I run one bsd apache server, and one win2k8 IIS server.

    There are a lot of reference's to this kind of setup, even on this forum. But everyone just points in the direction of haproxy, not how you would go about setting this up.

    From the gui, I have no idea how to set this up.
    I've found some information [1], [2], witch explain how to do get it up and working…
    But when I do a manual edit of the haproxy.cfg file, restart the haproxy service the old config pops up again.. :(

    [1] - http://jit.nuance9.com/2009/11/haproxy-routing-by-domain-name.html
    [2] - http://nixcraft.com/high-availability-cluster/15957-multiple-domain-subdomain-routing-haproxy-2.html

    Anyone care to explain what I need to do?

  • Guess I found my self answering my own question.
    Well, not entirely… Found another packaged mod_security witch did exactly what I wanted to do.

    Just remember to switch pfsense gui from http to https, otherwise mod_security will brake your setup when installed! :)

  • I'd love to know how you made it work.