Haproxy and CNAME

Posted by user123354 on Server Fault See other posts from Server Fault or by user123354
Published on 2012-06-03T14:57:10Z Indexed on 2012/06/03 16:42 UTC
Read the original article Hit count: 333

Filed under:
|
|

I want to create a simple load balancer for the two servers.

The problem is with CNAME records, I think.

Let's say I have two the same applications on AppFog.com.

app1.aws.af.cm and app2.aws.af.cm

Here is my haproxy.cfg file:

global
    maxconn 2000
    daemon

defaults
    mode http
    clitimeout 60000
    srvtimeout 30000
    contimeout 4000
    option httpclose

listen http_proxy 
    bind [myip]:80
    mode http
    stats enable
    stats auth user:passwd
    stats uri /stats
    balance source
    option httpchk
    option forwardfor
    server host01 app1.aws.af.cm:80 maxconn 300 check
    server host02 app2.aws.af.cm:80 maxconn 300 check

But this only resolving IP for domain app1.aws.af.cm and app2.aws.af.cm, which obviously doesn't work if I open this IP in web browser.

The problem is that AppFog doesn't have public IP for application (same as OpenShift).

How to do that Haproxy to perform a proper connection between Load Balancer and this two servers?

Example:

This is real app - http://freechat.eu01.aws.af.cm

Haproxy only resolves IP for this domain which is 46.51.204.8:80

Of course this IP will not show my application, only an error page.

Sorry for my poor English.

© Server Fault or respective owner

Related posts about domain

Related posts about ip