MEDIUM: proxy: Add a directive to reference an http-errors section in a proxy
It is now possible to import in a proxy, fully or partially, error files
declared in an http-errors section. It may be done using the "errorfiles"
directive, followed by a name and optionally a list of status code. If there is
no status code specified, all error files of the http-errors section are
imported. Otherwise, only error files associated to the listed status code are
imported. For instance :
http-errors my-errors
errorfile 400 ...
errorfile 403 ...
errorfile 404 ...
frontend frt
errorfiles my-errors 403 404 # ==> error 400 not imported
diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c
index 61bf7cd..86d1f33 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -262,7 +262,11 @@
}
/* initialize error relocations */
- memcpy(&curproxy->errmsg, &defproxy.errmsg, sizeof(defproxy.errmsg));
+ if (!proxy_dup_default_conf_errors(curproxy, &defproxy, &errmsg)) {
+ ha_alert("parsing [%s:%d] : proxy '%s' : %s\n", file, linenum, curproxy->id, errmsg);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
if (curproxy->cap & PR_CAP_FE) {
curproxy->maxconn = defproxy.maxconn;
@@ -502,7 +506,7 @@
free(defproxy.conf.logformat_sd_string);
free(defproxy.conf.lfsd_file);
- memset(&defproxy.errmsg, 0, sizeof(defproxy.errmsg));
+ proxy_release_conf_errors(&defproxy);
/* we cannot free uri_auth because it might already be used */
init_default_instance();