inetd for instance. This parameter is ignored if the "check" parameter is not
set. See also the "addr" parameter.
+proto <name>
+
+ Forces the multiplexer's protocol to use for the outgoing connections to this
+ server. It must be compatible with the mode of the backend (TCP or HTTP). It
+ must also be usable on the backend side. The list of available protocols is
+ reported in haproxy -vv.
+ Idea behind this optipon is to bypass the selection of the best multiplexer's
+ protocol for all connections established to this server.
+
redir <prefix>
The "redir" parameter enables the redirection mode for all GET and HEAD
requests addressing this server. This means that instead of having HAProxy
}
}
- /* Check the mux protocols, if any, for each listener
+ /* Check the mux protocols, if any, for each listener and server
* attached to the current proxy */
list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
int mode = (1 << (curproxy->mode == PR_MODE_HTTP));
cfgerr++;
}
}
+ for (newsrv = curproxy->srv; newsrv; newsrv = newsrv->next) {
+ int mode = (1 << (curproxy->mode == PR_MODE_HTTP));
+
+ if (!newsrv->mux_proto)
+ continue;
+ if (!(newsrv->mux_proto->mode & mode)) {
+ ha_alert("config : %s '%s' : MUX protocol '%.*s' is not usable for server '%s' at [%s:%d].\n",
+ proxy_type_str(curproxy), curproxy->id,
+ (int)newsrv->mux_proto->token.len,
+ newsrv->mux_proto->token.ptr,
+ newsrv->id, newsrv->conf.file, newsrv->conf.line);
+ cfgerr++;
+ }
+ }
}
/***********************************************************/
#include <proto/applet.h>
#include <proto/cli.h>
#include <proto/checks.h>
+#include <proto/connection.h>
#include <proto/port_range.h>
#include <proto/protocol.h>
#include <proto/queue.h>
srv->pp_opts |= flags;
return 0;
}
+/* parse the "proto" server keyword */
+static int srv_parse_proto(char **args, int *cur_arg,
+ struct proxy *px, struct server *newsrv, char **err)
+{
+ struct ist proto;
+
+ if (!*args[*cur_arg + 1]) {
+ memprintf(err, "'%s' : missing value", args[*cur_arg]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+ proto = ist2(args[*cur_arg + 1], strlen(args[*cur_arg + 1]));
+ newsrv->mux_proto = get_mux_proto(proto);
+ if (!newsrv->mux_proto) {
+ memprintf(err, "'%s' : unknown MUX protocol '%s'", args[*cur_arg], args[*cur_arg+1]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+ else if (!(newsrv->mux_proto->side & PROTO_SIDE_BE)) {
+ memprintf(err, "'%s' : MUX protocol '%s' cannot be used for outgoing connections",
+ args[*cur_arg], args[*cur_arg+1]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+ return 0;
+}
/* parse the "proxy-v2-options" */
static int srv_parse_proxy_v2_options(char **args, int *cur_arg,
{ "no-send-proxy-v2", srv_parse_no_send_proxy_v2, 0, 1 }, /* Disable use of PROXY V2 protocol */
{ "non-stick", srv_parse_non_stick, 0, 1 }, /* Disable stick-table persistence */
{ "observe", srv_parse_observe, 1, 1 }, /* Enables health adjusting based on observing communication with the server */
+ { "proto", srv_parse_proto, 1, 1 }, /* Set the proto to use for all outgoing connections */
{ "proxy-v2-options", srv_parse_proxy_v2_options, 1, 1 }, /* options for send-proxy-v2 */
{ "redir", srv_parse_redir, 1, 1 }, /* Enable redirection mode */
{ "send-proxy", srv_parse_send_proxy, 0, 1 }, /* Enforce use of PROXY V1 protocol */
#ifdef TCP_USER_TIMEOUT
srv->tcp_ut = src->tcp_ut;
#endif
+ srv->mux_proto = src->mux_proto;
+
if (srv_tmpl)
srv->srvrq = src->srvrq;
}