From: Willy Tarreau Date: Mon, 15 Mar 2010 18:44:39 +0000 (+0100) Subject: [MINOR] http: don't mark a server as failed when it returns 501/505 X-Git-Tag: v1.4.2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=396504089897fd373c87435eb4d51c6e7ae1f32e;p=thirdparty%2Fhaproxy.git [MINOR] http: don't mark a server as failed when it returns 501/505 Those two codes can be triggered on demand by client requests. We must not fail a server on them. Ideally we should ignore a certain amount of status codes which do not indicate life nor death. --- diff --git a/src/proto_http.c b/src/proto_http.c index ad44a2edbc..f1ec7cd84f 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4503,7 +4503,11 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) txn->status = strl2ui(msg->sol + msg->sl.st.c, msg->sl.st.c_l); - if (txn->status >= 100 && txn->status < 500) + /* Adjust server's health based on status code. Note: status codes 501 + * and 505 are triggered on demand by client request, so we must not + * count them as server failures. + */ + if (txn->status >= 100 && (txn->status < 500 || txn->status == 501 || txn->status == 505)) health_adjust(s->srv, HANA_STATUS_HTTP_OK); else health_adjust(s->srv, HANA_STATUS_HTTP_STS);