The first keyword is the rule's action. Several types of actions are
supported:
- accept
- - attach-srv <srv>
+ - attach-srv <srv> [name <expr>]
- reject
- sc-add-gpc(<idx>,<sc-id>) { <int> | <expr> }
- sc-inc-gpc(<idx>,<sc-id>)
This is used to accept the connection. No further "tcp-request session"
rules are evaluated.
-tcp-request session attach-srv <srv>
+tcp-request session attach-srv <srv> [name <expr>]
This is used to intercept the connection after proper HTTP/2 establishment.
The connection is reversed to the backend side and inserted into the idle
pool of <srv> server. This is useful for reverse server with '@reverse'
address.
+ An extra parameter <expr> can be specified. Its value is interpreted as a
+ sample expression to name the connection inside the server idle pool. When
+ routing an outgoing request through this server, this name will be matched
+ against the 'sni' parameter of the server line. Otherwise, the connection
+ will have no name and will only match requests without SNI.
+
This rule is only valid for frontend in HTTP mode. Also all listeners must
not require a protocol different from HTTP/2.
static void release_attach_srv_action(struct act_rule *rule)
{
ha_free(&rule->arg.attach_srv.srvname);
+ release_sample_expr(rule->arg.attach_srv.name);
}
/*
return 0;
}
+ if ((rule->arg.attach_srv.name && (!srv->use_ssl || !srv->sni_expr)) ||
+ (!rule->arg.attach_srv.name && srv->use_ssl && srv->sni_expr)) {
+ memprintf(err, "attach-srv rule: connection will never be used; either specify name argument in conjonction with defined SSL SNI on targetted server or none of these");
+ return 0;
+ }
+
rule->arg.attach_srv.srv = srv;
return 1;
struct act_rule *rule, char **err)
{
char *srvname;
+ struct sample_expr *expr;
rule->action = ACT_CUSTOM;
rule->action_ptr = tcp_action_attach_srv;
rule->release_ptr = release_attach_srv_action;
rule->check_ptr = tcp_check_attach_srv;
rule->arg.attach_srv.srvname = NULL;
+ rule->arg.attach_srv.name = NULL;
srvname = my_strndup(args[*cur_arg], strlen(args[*cur_arg]));
if (!srvname)
++(*cur_arg);
+ while (args[*cur_arg] && args[*cur_arg][0] != '\0') {
+ if (strcmp(args[*cur_arg], "name") == 0) {
+ ++(*cur_arg);
+
+ expr = sample_parse_expr((char **)args, cur_arg, px->conf.args.file, px->conf.args.line,
+ err, &px->conf.args, NULL);
+ if (!expr)
+ return ACT_RET_PRS_ERR;
+
+ rule->arg.attach_srv.name = expr;
+ rule->release_ptr = release_attach_srv_action;
+ ++(*cur_arg);
+ }
+ else {
+ memprintf(err, "Unknown argument.");
+ return ACT_RET_PRS_ERR;
+ }
+ }
+
return ACT_RET_PRS_OK;
err:
ha_free(&rule->arg.attach_srv.srvname);
+ release_sample_expr(rule->arg.attach_srv.name);
return ACT_RET_PRS_ERR;
}