Re: HAProxy and customer Mongrel Handler for Health check

From: Willy Tarreau <>
Date: Thu, 11 Sep 2008 23:06:01 +0200

Hello Ladislav,

On Thu, Sep 04, 2008 at 11:42:30AM +0100, Ladislav Martincik wrote:
> Hello guys,
> I'm using HAProxy for our project in company I work for. The application is
> written with *Ruby and Rails* and we really love HAProxy for Low balancing
> among Mongrels. One problem we have right now is unnecessary trafic caused
> by HAProxy *Health check with OPTION* requests sending *"http:// / "*
> or*"http://:/
> "*. I've tried to modify standard configuration of health checks to send
> request to particular *URI "/health_check" *and because I wanted to not have
> the log full of unnecessary log informations of healt checks I've decided to
> write custom *Mongrel handler* to send plain text with timestamp. The
> problem is that it didn't worked for me and I still have "http:// / "
> requests inside our production log. I'll paste all config files and source
> codes here so you can have a look and hopefully help me find the problem why
> isn't working as it should be.

You're wasting your time, haproxy is not sending those requests, it just sends the requests you configured (eg: GET /health_check HTTP/1.0). It is your application server which is doing funny things when it interpretes the requests. It seems to translate them into proxy requests (http://) and then put an empty host name when no Host: field was set. The Host: field is HTTP/1.1 and is not mandatory at all in 1.0. So if your server is only writing wrong log, it's half of a problem. What is more of a problem is if it does not process HTTP/1.0 requests correctly, because there are still proxies and proxies which only forward requests as 1.0 outside. Apache 1.3 with mod_proxy is one of them. So I hope it does not affect your traffic.

As a workaround, you can force haproxy to send a Host: field by appending it after the HTTP version. Warning, it's extremely dirty but basically works. Example :

    option httpchk HEAD /health_check HTTP/1.0\r\nHost:\

But I would still recommend that you investigate into fixing your application server (or web server, I don't know).

> listen aeryn_proxy
> log global
> # - equal weights on all servers
> # - maxconn will queue requests at HAProxy if limit is reached
> # - minconn dynamically scales the connection concurrency (bound my
> maxconn) depending on size of HAProxy queue
> # - check health every 20000 microseconds

Warning above, you should fix the comment, it's every 20000 milliseconds and not microseconds. Starting with 1.3.15, you can write "inter 20s" to avoid doing mistakes :-)

Willy Received on 2008/09/11 23:06

This archive was generated by hypermail 2.2.0 : 2008/09/11 23:16 CEST