Re: http-check string and rerturn code != 200 behaviour

2015-02-17 Thread Sébastien ROHAUT
Hi,

Thank you for your answer. I changed my configuration like this :

  tcp-check send GET\ /mycheck\ HTTP/1.1\r\nHost:\ myhost\r\nConnection:\
close\r\n
  tcp-check send \r\n
  tcp-check expect string HTTP/1.1\ 200\ OK
  tcp-check expect ! string healthStatus:Unhealthy

And it works very well. Even in SSL. You now have my eternal gratitude :)

Sébastien Rohaut

2015-02-16 22:22 GMT+01:00 Baptiste bed...@gmail.com:

 On Mon, Feb 16, 2015 at 9:29 PM, Sébastien ROHAUT
 sebastien.rohaut@gmail.com wrote:
  Hi,
 
  I'm using an http-check expect string to test the presence of a certain
  string in the body response. Like this
 
  option httpchk GET /mycheck HTTP/1.1\r\nHost:\ myhost.xx\r\nConnection:\
  close
  http-check expect ! string healthStatus:Unhealthy
 
  When the backend is not accessible, our nginx returns a default page,
 with a
  5XX return code.
 
  In this case (return code != 200), it should be considered as an error,
 and
  the associated serveur should be removed from the server. It's not the
 case
  : HAProxy only check the string, and says it's OK.
 
  Question :
 
  How to check the string AND check the return code ? I want my server to
 be
  removed if string is absent OR if return code is != 200 !
 
  Thank you,
 
  Sébastien Rohaut

 Hi Sébastien,

 You can write such séquence using tcp-check, sending your HTTP request
 with tcp-check send and matching with two consecutive tcp-check expect
 rules:
 tcp-check expect string HTTP/1.1\ 200\ OK
 tcp-check expect ! string healthStatus:Unhealthy

 Baptiste



Re: http-check string and rerturn code != 200 behaviour

2015-02-17 Thread Baptiste
On Tue, Feb 17, 2015 at 10:12 AM, Sébastien ROHAUT
sebastien.rohaut@gmail.com wrote:
 Hi,

 Thank you for your answer. I changed my configuration like this :

   tcp-check send GET\ /mycheck\ HTTP/1.1\r\nHost:\ myhost\r\nConnection:\
 close\r\n
   tcp-check send \r\n
   tcp-check expect string HTTP/1.1\ 200\ OK
   tcp-check expect ! string healthStatus:Unhealthy

 And it works very well. Even in SSL. You now have my eternal gratitude :)

 Sébastien Rohaut


Sébastien,

Thanks for your feedback!
If you don't mind, I'm going to post a blog article on
blog.haproxy.com with this tip :)

Baptiste



Re: http-check string and rerturn code != 200 behaviour

2015-02-17 Thread Sébastien ROHAUT
Of course ! A very good idea ! But the better should be to accept multiple
http-heck expect :)

2015-02-17 10:25 GMT+01:00 Baptiste bed...@gmail.com:

 On Tue, Feb 17, 2015 at 10:12 AM, Sébastien ROHAUT
 sebastien.rohaut@gmail.com wrote:
  Hi,
 
  Thank you for your answer. I changed my configuration like this :
 
tcp-check send GET\ /mycheck\ HTTP/1.1\r\nHost:\ myhost\r\nConnection:\
  close\r\n
tcp-check send \r\n
tcp-check expect string HTTP/1.1\ 200\ OK
tcp-check expect ! string healthStatus:Unhealthy
 
  And it works very well. Even in SSL. You now have my eternal gratitude :)
 
  Sébastien Rohaut


 Sébastien,

 Thanks for your feedback!
 If you don't mind, I'm going to post a blog article on
 blog.haproxy.com with this tip :)

 Baptiste



Re: http-check string and rerturn code != 200 behaviour

2015-02-17 Thread Baptiste
On Tue, Feb 17, 2015 at 10:29 AM, Sébastien ROHAUT
sebastien.rohaut@gmail.com wrote:
 Of course ! A very good idea ! But the better should be to accept multiple
 http-heck expect :)

There is a feature request to turn the httpchk as the current
tcp-check way of working with multiple matching rules and simple
header addition.
That said should not be there for 1.6...

Baptiste



http-check string and rerturn code != 200 behaviour

2015-02-16 Thread Sébastien ROHAUT
Hi,

I'm using an http-check expect string to test the presence of a certain
string in the body response. Like this

option httpchk GET /mycheck HTTP/1.1\r\nHost:\ myhost.xx\r\nConnection:\
close
http-check expect ! string healthStatus:Unhealthy

When the backend is not accessible, our nginx returns a default page, with
a 5XX return code.

In this case (return code != 200), it should be considered as an error, and
the associated serveur should be removed from the server. It's not the case
: HAProxy only check the string, and says it's OK.

Question :

How to check the string AND check the return code ? I want my server to be
removed if string is absent OR if return code is != 200 !

Thank you,

Sébastien Rohaut


Re: http-check string and rerturn code != 200 behaviour

2015-02-16 Thread Baptiste
On Mon, Feb 16, 2015 at 9:29 PM, Sébastien ROHAUT
sebastien.rohaut@gmail.com wrote:
 Hi,

 I'm using an http-check expect string to test the presence of a certain
 string in the body response. Like this

 option httpchk GET /mycheck HTTP/1.1\r\nHost:\ myhost.xx\r\nConnection:\
 close
 http-check expect ! string healthStatus:Unhealthy

 When the backend is not accessible, our nginx returns a default page, with a
 5XX return code.

 In this case (return code != 200), it should be considered as an error, and
 the associated serveur should be removed from the server. It's not the case
 : HAProxy only check the string, and says it's OK.

 Question :

 How to check the string AND check the return code ? I want my server to be
 removed if string is absent OR if return code is != 200 !

 Thank you,

 Sébastien Rohaut

Hi Sébastien,

You can write such séquence using tcp-check, sending your HTTP request
with tcp-check send and matching with two consecutive tcp-check expect
rules:
tcp-check expect string HTTP/1.1\ 200\ OK
tcp-check expect ! string healthStatus:Unhealthy

Baptiste