This commits completes "add backend" handler with some checks performed
on the specified default proxy instance. These are additional checks
outside of the already existing inheritance rules, specific to dynamic
backends.
For now, a default proxy is considered not compatible if it is not in
mode TCP/HTTP. Also, a default proxy is rejected if it references HTTP
errors. This limitation may be lifted in the future, when HTTP errors
are partiallay reworked.
in the unpublished state. Once considered ready for traffic, use "publish
backend" to expose the newly created instance.
+ All named default proxies can be used, given that they validate the same
+ inheritance rules applied during configuration parsing. There is some
+ exceptions though, for example when the mode is neither TCP nor HTTP. Another
+ exception is that it is not yet possible to use a default proxies which
+ reference custom HTTP errors, for example via the errorfiles or http-rules
+ keywords.
+
This command is restricted and can only be issued on sockets configured for
level "admin". Moreover, this feature is still considered in development so it
also requires experimental mode (see "experimental-mode on").
cli_dynerr(appctx, memprintf(&msg, "Mode is required as '%s' default proxy does not explicitely defines it.\n", def_name));
return 1;
}
+ if (defpx->mode != PR_MODE_TCP && defpx->mode != PR_MODE_HTTP) {
+ cli_dynerr(appctx, memprintf(&msg, "Dynamic backends only support TCP or HTTP mode, whereas default proxy '%s' uses 'mode %s'.\n",
+ def_name, proxy_mode_str(defpx->mode)));
+ return 1;
+ }
+ if (!LIST_ISEMPTY(&defpx->conf.errors)) {
+ cli_dynerr(appctx, memprintf(&msg, "Dynamic backends cannot inherit from default proxy '%s' because it references HTTP errors.\n", def_name));
+ return 1;
+ }
thread_isolate();