commit 54824cf35520b11ff97e0937beeb429dcdc55fd0
Author: Christopher Faulet <cfaulet@haproxy.com>
Date:   Mon Nov 12 11:57:31 2018 +0100

    BUG/MINOR: config: Copy default error messages when parsing of a backend starts
    
    To be used, error messages declared in a default section must be copied when the
    parsing of a proxy section starts. But this was only done for frontends.
    
    This patch may be backported to older versions.
    
    (cherry picked from commit 6b44975fbd2f7d81074e20bc07fc0e01466cc9c9)
    Signed-off-by: William Lallemand <wlallemand@haproxy.org>

diff --git a/src/cfgparse.c b/src/cfgparse.c
index 618ffd39..6bc6b259 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2787,15 +2787,15 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 			curproxy->server_id_hdr_name = strdup(defproxy.server_id_hdr_name);
 		}
 
+		/* initialize error relocations */
+		for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
+			chunk_dup(&curproxy->errmsg[rc], &defproxy.errmsg[rc]);
+
 		if (curproxy->cap & PR_CAP_FE) {
 			curproxy->maxconn = defproxy.maxconn;
 			curproxy->backlog = defproxy.backlog;
 			curproxy->fe_sps_lim = defproxy.fe_sps_lim;
 
-			/* initialize error relocations */
-			for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
-				chunk_dup(&curproxy->errmsg[rc], &defproxy.errmsg[rc]);
-
 			curproxy->to_log = defproxy.to_log & ~LW_COOKIE & ~LW_REQHDR & ~ LW_RSPHDR;
 		}