Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more information about 413 response code #46

Open
lamiska opened this issue Jul 3, 2024 · 0 comments
Open

Add more information about 413 response code #46

lamiska opened this issue Jul 3, 2024 · 0 comments

Comments

@lamiska
Copy link

lamiska commented Jul 3, 2024

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;

Can you add information about 413 code into documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant