HAProxy health checks: using httpchk and observe?
The distinction I understand now is that /check.txt does actually return a 200 response but all requests to the application return a 500. HAProxy sees the 500s coming back from the proxied requests and takes the server out of the pool but then initiates its own check, receives a 200 and puts the server back in the pool.
The solution would be to do one of:
- Configure Apache, rather than the application, so that every request returns a 500 response, even the static file
/check.txt
. - Change
/check.txt
into a Ruby app that contains just enough logic to choose between a 200 and a 500 response when appropriate. - Set the
inter
value to something ridiculous like 3600. This should give you an hour to do your testing or (if the server went down on its own) figure out the problem and bring it back up. - Set the
inter
value to something smaller like 60 but set therise
value to something higher like 60. This would also give you an hour before the server was added back to the pool. (Note, these two are listed last because they're probably very bad ideas.)