mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-23 19:03:06 -04:00
MEDIUM: proxy: remove http-errors limitation for dynamic backends
Use proxy_check_http_errors() on defaults proxy instances. This will emit alert messages for errorfiles directives referencing a non-existing http-errors section, or a warning if an explicitely listed status code is not present in the target section. This is a small behavior changes, as previouly this was only performed for regular proxies. Thus, errorfile/errorfiles directives in an unused defaults were never checked. This may prevent startup of haproxy with a configuration file previously considered as valid. However, this change is considered as necessary to be able to use http-errors with dynamic backends. Any invalid defaults will be detected on startup, rather than having to discover it at runtime via "add backend" invokation. Thus, any restriction on http-errors usage is now lifted for the creation of dynamic backends.
This commit is contained in:
parent
2ca7601c2d
commit
c6fc53aa99
3 changed files with 4 additions and 8 deletions
|
|
@ -1740,10 +1740,7 @@ add backend <name> from <defproxy> [mode <mode>] [guid <guid>] [ EXPERIMENTAL ]
|
|||
|
||||
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.
|
||||
exceptions though, for example when the mode is neither TCP nor HTTP.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
#include <haproxy/global.h>
|
||||
#include <haproxy/http_ana.h>
|
||||
#include <haproxy/http_rules.h>
|
||||
#include <haproxy/http_htx.h>
|
||||
#include <haproxy/lb_chash.h>
|
||||
#include <haproxy/lb_fas.h>
|
||||
#include <haproxy/lb_fwlc.h>
|
||||
|
|
@ -2392,6 +2393,8 @@ int check_config_validity()
|
|||
else {
|
||||
cfgerr += acl_find_targets(defpx);
|
||||
}
|
||||
|
||||
err_code |= proxy_check_http_errors(defpx);
|
||||
}
|
||||
|
||||
/* starting to initialize the main proxies list */
|
||||
|
|
|
|||
|
|
@ -4918,10 +4918,6 @@ static int cli_parse_add_backend(char **args, char *payload, struct appctx *appc
|
|||
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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue