diff --git a/doc/configuration.txt b/doc/configuration.txt index a1a743f0b..b55a8077e 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -7099,7 +7099,7 @@ maxconn See also : "server", global section's "maxconn", "fullconn" -mode { tcp|http|health } +mode { tcp|http } Set the running mode or protocol of the instance May be used in sections : defaults | frontend | listen | backend yes | yes | yes | yes @@ -7115,15 +7115,6 @@ mode { tcp|http|health } processing and switching will be possible. This is the mode which brings HAProxy most of its value. - health The instance will work in "health" mode. It will just reply "OK" - to incoming connections and close the connection. Alternatively, - If the "httpchk" option is set, "HTTP/1.0 200 OK" will be sent - instead. Nothing will be logged in either case. This mode is used - to reply to external components health checks. This mode is - deprecated and should not be used anymore as it is possible to do - the same and even better by combining TCP or HTTP modes with the - "monitor" keyword. - When doing content switching, it is mandatory that the frontend and the backend are in the same mode (generally HTTP), otherwise the configuration will be refused. @@ -7132,8 +7123,6 @@ mode { tcp|http|health } defaults http_instances mode http - See also : "monitor", "monitor-net" - monitor fail { if | unless } Add a condition to report a failure to a monitor HTTP request. diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index da728a37e..18f6d554f 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -46,7 +46,6 @@ enum pr_mode { PR_MODE_TCP = 0, PR_MODE_HTTP, - PR_MODE_HEALTH, PR_MODE_CLI, PR_MODE_SYSLOG, PR_MODE_PEERS, @@ -247,7 +246,7 @@ struct error_snapshot { struct proxy { enum obj_type obj_type; /* object type == OBJ_TYPE_PROXY */ char disabled; /* non-zero if disabled or shutdown */ - enum pr_mode mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP or PR_MODE_HEALTH */ + enum pr_mode mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP, ... */ char cap; /* supported capabilities (PR_CAP_*) */ unsigned int maxconn; /* max # of active streams on the frontend */ diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 6f324fafa..211c4b605 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -703,7 +703,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) if (!strcmp(args[1], "http")) curproxy->mode = PR_MODE_HTTP; else if (!strcmp(args[1], "tcp")) curproxy->mode = PR_MODE_TCP; - else if (!strcmp(args[1], "health")) curproxy->mode = PR_MODE_HEALTH; + else if (!strcmp(args[1], "health")) { + ha_alert("parsing [%s:%d] : 'mode health' doesn't exist anymore. Please use 'http-request return status 200' instead.\n", file, linenum); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } else { ha_alert("parsing [%s:%d] : unknown proxy mode '%s'.\n", file, linenum, args[1]); err_code |= ERR_ALERT | ERR_FATAL; diff --git a/src/cfgparse.c b/src/cfgparse.c index 12585d061..902fc0e14 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2330,19 +2330,6 @@ int check_config_validity() } switch (curproxy->mode) { - case PR_MODE_HEALTH: - cfgerr += proxy_cfg_ensure_no_http(curproxy); - if (!(curproxy->cap & PR_CAP_FE)) { - ha_alert("config : %s '%s' cannot be in health mode as it has no frontend capability.\n", - proxy_type_str(curproxy), curproxy->id); - cfgerr++; - } - - if (curproxy->srv != NULL) - ha_warning("config : servers will be ignored for %s '%s'.\n", - proxy_type_str(curproxy), curproxy->id); - break; - case PR_MODE_TCP: cfgerr += proxy_cfg_ensure_no_http(curproxy); break; @@ -2370,7 +2357,7 @@ int check_config_validity() err_code |= ERR_WARN; } - if ((curproxy->cap & PR_CAP_BE) && (curproxy->mode != PR_MODE_HEALTH)) { + if (curproxy->cap & PR_CAP_BE) { if (curproxy->lbprm.algo & BE_LB_KIND) { if (curproxy->options & PR_O_TRANSP) { ha_alert("config : %s '%s' cannot use both transparent and balance mode.\n", diff --git a/src/proxy.c b/src/proxy.c index 79ba5a679..43c236228 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -138,8 +138,6 @@ const char *proxy_mode_str(int mode) { return "tcp"; else if (mode == PR_MODE_HTTP) return "http"; - else if (mode == PR_MODE_HEALTH) - return "health"; else if (mode == PR_MODE_CLI) return "cli"; else diff --git a/src/session.c b/src/session.c index c5af3c40a..ab023b448 100644 --- a/src/session.c +++ b/src/session.c @@ -197,8 +197,7 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr * in order to avoid emission of an RST by the system. We ignore any * error. */ - if (unlikely((p->mode == PR_MODE_HEALTH) || - ((l->options & LI_O_CHK_MONNET) && + if (unlikely(((l->options & LI_O_CHK_MONNET) && addr->ss_family == AF_INET && (((struct sockaddr_in *)addr)->sin_addr.s_addr & p->mon_mask.s_addr) == p->mon_net.s_addr))) { /* we have 4 possibilities here : @@ -209,12 +208,8 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr */ if (l->rx.proto->drain) l->rx.proto->drain(cfd); - if (p->mode == PR_MODE_HTTP || - (p->mode == PR_MODE_HEALTH && (p->options2 & PR_O2_CHK_ANY) == PR_O2_TCPCHK_CHK && - (p->tcpcheck_rules.flags & TCPCHK_RULES_PROTO_CHK) == TCPCHK_RULES_HTTP_CHK)) + if (p->mode == PR_MODE_HTTP) send(cfd, "HTTP/1.0 200 OK\r\n\r\n", 19, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_MORE); - else if (p->mode == PR_MODE_HEALTH) - send(cfd, "OK\n", 3, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_MORE); ret = 0; goto out_free_sess; }