sometimes the HAProxy instance forwards the Statistics Report request to the backends instead of serving the statistics by itself.

i've tried with the following versions:

  • 1.3.18
  • 1.3.22

every installed version does the same. the first stat request usually answered by HAProxy but after some reload in the browser it'll being forwarded

the corresponding part of the configuration looks like this:

  log   local0
  log   local1 notice

  maxconn 4096

  user haproxy
  group haproxy
  nbproc  4

  log     global
  mode    http
  option  httplog
  option  dontlognull
  retries 3
  option redispatch
  maxconn 2000
  contimeout      5000
  clitimeout      10000
  srvtimeout      10000

  stats enable
  stats auth haproxy:test

backend appserver
  balance roundrobin

  reqidel ^X-Fowarded-For
  option httpchk GET / HTTP/1.0

  server appserver1 weight 1 check
  server appserver2 weight 1 check

frontend http

  default_backend appserver

as the README says. what could be the problem with this?


migrated from stackoverflow.com Feb 16 '10 at 8:35

This question came from our site for professional and enthusiast programmers.


Simple: your configuration is missing a "option httpclose" statement in the defaults section. Just add this and it will be fixed. The reason is that if you send a stats request on a session that is already established with a server and kept alive, only the server sees it.

  • since yesterday I'm using the 'forceclose' option because it'll close those connections that are not closed by the client. and since 'forceclose' includes 'httpclose', it fixed it. so thanks for the answer it fixed my problem! the only thing I don't understand is: the established connection was made by my client to the HAProxy. it served the request so it should not forward this one to any of the backends because it is a stat request, not a normal one. so it seems like a bug in HAProxy. – KARASZI István Dec 23 '09 at 10:21
  • No, it's simply because you made one first request to your server, and your browser established a keep-alive connection to that one. Then you go to the stats and the browser reuses the same connection since it's on the same site. Unfortunately, haproxy does not see the request which is considered as pure data of the first connection. Version 1.4 adds support for keep-alive which will definitely solve those common issues. – Willy Tarreau Jan 17 '10 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.