Welcome! Log In Create A New Profile

Advanced

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

All files from this thread

File Name File Size   Posted by Date  
patch.413 530 bytes open | download Igor Sysoev 09/01/2009 Read message
Igor Sysoev
September 02, 2009 05:49PM
On Mon, Aug 31, 2009 at 05:25:45PM +0000, Peter Vandenberk wrote:

> Hi Igor,
>
> Igor Sysoev <is@...> writes:
> > The attached patch should fix the bug.
>
> Thanks for the quick reply to my question, and for taking the time
> to supply a patch... much appreciated!
>
> The patch works like a charm... thanks for that! I forgot to mention
> that we are running the "legacy" 0.6.xx version of nginx, so I have
> attached a slightly modified version of your patch with the correct
> diff context (esp. line numbers) for that version of the code base.

Yes, the patch should work for 0.6.x too.

> Igor Sysoev <is@...> writes:
> > However, browsers usually show the 413 error page only after they have sent
> > a whole request body. Therefore on slow connection and with large body
> > browsers will show some network error or "this page cannot be displayed" page.
>
> Yes, thanks for the heads up... some of our users have indeed reported
> that behaviour to us as well, but quite a few also get a proper 413 response,
> which is why we are so eager to implement a custom 413 error page.

You may increase

lingering_time 30s; # default
lingering_timeout 5s; # default

lingering_time sets how long nginx will read discarded body before closing
connection. lingering_timeout is timeout between two read() operation.
If client did not send anything during this time, then nginx closes
connection.


> Thanks again for your time and the patch!
>
> Peter
>
> ===
>
> *** src/http/ngx_http_core_module.orig 2009-08-31 18:10:46.000000000 +0100
> --- src/http/ngx_http_core_module.c 2009-08-31 18:11:26.000000000 +0100
> ***************
> *** 859,864 ****
> --- 859,865 ----
> "client intended to send too large body: %O bytes",
> r->headers_in.content_length_n);
>
> + (void) ngx_http_discard_request_body(r);
> ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
> return NGX_OK;
> }
>
>
>

--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Bug: custom error_page doesn't work for HTTP 413 (content too large)

Michael Nachbaur June 03, 2009 07:13PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

pvdb August 31, 2009 11:26AM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

pvdb August 31, 2009 11:38AM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large) Attachments

Igor Sysoev August 31, 2009 12:22PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

pvdb August 31, 2009 01:25PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

Igor Sysoev September 02, 2009 05:49PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

estebistec June 18, 2010 12:48PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

estebistec June 23, 2010 06:49PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

Maxim Dounin June 20, 2010 07:28PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

estebistec June 21, 2010 09:19AM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

Maxim Dounin June 21, 2010 12:24PM

Re: Bug: custom error_page doesn't work for HTTP 413 (content too large)

estebistec June 21, 2010 09:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 288
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready