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
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.
defaults http_instances
mode http
- See also : "monitor", "monitor-net"
-
monitor fail { if | unless } <condition>
Add a condition to report a failure to a monitor HTTP request.
enum pr_mode {
PR_MODE_TCP = 0,
PR_MODE_HTTP,
- PR_MODE_HEALTH,
PR_MODE_CLI,
PR_MODE_SYSLOG,
PR_MODE_PEERS,
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 */
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;
}
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;
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",
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
* 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 :
*/
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;
}