Haproxy error 413 paylod too large

Hello,
I’m using haproxy as LB for rabbitmq management portal.
When I try to purge a queue in the UI, I get error 413 payload too large.
In this article https://bobcares.com/blog/413-request-entity-too-large-haproxy , the author talk about “http-request max-body-size” option, but if I try to add it, even frontend or backend, I get the error “http-request expected set-hdr […] passed max-body-size”.

I have already try with tune options, but nothing worked.
This are the options I used for testing purpose:
tune.bufsize 131072
tune.maxrewrite 32768
tune.http.cookielen 1024

How can I increase the http body size in haproxy?
Thanks.
Simone.

I don’t think HAProxy will generate 413 responses without specific configuration… I’d advise you have a look through the access log from HAProxy. It should lead you to “who” is making the 413 response.

Unfortunately haproxy documentation does not provide enough information about 413 response code.

In haproxy documentation it is specified that:

Currently, HAProxy is capable of
          generating codes 200, 400, 401, 403, 404, 405, 407, 408, 410,
          413, 425, 429, 500, 501, 502, 503, and 504.

But further down in https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#1.4.1 it is specified only:

HAProxy may emit the following status codes by itself :
....
   410  when the requested resource is no longer available and will not
        be available again
   500  when HAProxy encounters an unrecoverable internal error, such as a
        memory allocation failure, which should never happen
....

And information when 413 is generated is not provided. However haproxy can and will return 413 in some cases:

2024 IP https~ https/<NOSRV> -1/-1/-1/-1/0 413 0 - - PR-- 10/10/0/0/0 0/0 "<BADREQ>"

The only way to find more about 413 code is to look at source code of haproxy where more information is provided with configuration option for potential fix:

        /* Reject HTTP/1.0 GET/HEAD/DELETE requests with a payload except if
         * accept_payload_with_any_method global option is set.
         *There is a payload if the c-l is not null or the the payload is
         * chunk-encoded.  A parsing error is reported but a A
         * 413-Payload-Too-Large is returned instead of a 400-Bad-Request.
         */
        if (!accept_payload_with_any_method &&
            !(h1m->flags & (H1_MF_RESP|H1_MF_VER_11)) &&
            (((h1m->flags & H1_MF_CLEN) && h1m->body_len) || (h1m->flags & H1_MF_CHNK)) &&
            (h1sl.rq.meth == HTTP_METH_GET || h1sl.rq.meth == HTTP_METH_HEAD || h1sl.rq.meth == HTTP_METH_DELETE)) {
                h1s->flags |= H1S_F_PARSING_ERROR;
                htx->flags |= HTX_FL_PARSING_ERROR;
                h1s->h1c->errcode = 413;


A doc change was committed: