Hi Roy

You simply need to send an HTTP 1.1 request with a Host: header in the http
check, like this:

option httpchk GET /index.html\r\nHost: vhost.example.com

Graeme.

On 17 August 2010 23:19, Roy Smith <r...@panix.com> wrote:

> I'm running "HA-Proxy version 1.3.22" on Ubuntu Linux.  I've got apache set
> up with two virtual hosts, and I want to use haproxy to round-robin between
> them.  Ultimately, these virtual hosts will be on different machines, but
> for my testing environment, they're on the same box.  I've got a config file
> I'm using for testing:
>
> > global
> >     maxconn 100
> >
> > listen webfarm cluster6:23000
> >    mode http
> >    option httpclose
> >    balance roundrobin
> >    cookie SERVERID insert indirect
> >    timeout server 5s
> >    timeout client 5s
> >    timeout connect 5s
> >    option httpchk GET /index.html HTTP/1.0
> >    server webA test1.cluster6.corp.amiestreet.com:80 cookie A check
> inter 2s
> >    server webB test2.cluster6.corp.amiestreet.com:80 cookie B check
> inter 2s
>
>
> As soon as I start haproxy up, I get:
>
> > [WARNING] 228/171101 (20636) : Server webfarm/webA is DOWN. 1 active and
> 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
> > [WARNING] 228/171102 (20636) : Server webfarm/webB is DOWN. 0 active and
> 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
> > [ALERT] 228/171102 (20636) : proxy 'webfarm' has no server available!
>
>
> The problem seems to be that when it sends the HTTP requests to apache, it
> leaves out the Host: header.  For example, strace shows that wget does:
>
> > write(3, "GET /index.html HTTP/1.0\r\nUser-Agent: Wget/1.12
> (linux-gnu)\r\nAccept: */*\r\nHost: 
> test1.cluster6.corp.amiestreet.com\r\nConnection:
> Keep-Alive\r\n\r\n", 142\
> > ) = 142
>
>
> but haproxy just does:
>
> > sendto(5, "GET /index.html HTTP/1.0\r\n\r\n", 28,
> MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 28
>
> How do I get haproxy to work and play well with virtual hosts?
>
>
>

Reply via email to