Welcome! Log In Create A New Profile

Advanced

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
Michael Nachbaur
June 03, 2009 07:13PM
After a few hours of digging through the nginx code, I think I've
discovered the nature of the bug, but I still don't know how to fix it
just yet. I'm using the 3rd-party upload module to handle my uploads,
which are then sent along to a fastcgi process.

The problem I'm having is I can't seem to set a custom error page for
HTTP 413 errors. If I issue a file upload to an nginx url and it
exceeds the maximum size set in my configuration, I want the custom
error page to show. Instead I get the nginx default.

error_page 413 /err/413.html

when I upload will give me something like this in my error log:

2009/06/03 23:08:06 [error] 19180#0: *163 client intended to send too
large body: 995365 bytes, client: 192.168.98.223, server: localhost,
request: "POST /attach HTTP/1.1", host: "localhost:10443", referrer: "https://localhost:10443/attach
"
2009/06/03 23:08:06 [error] 19180#0: *163 client intended to send too
large body: 995365 bytes, client: 192.168.98.223, server: localhost,
request: "POST /attach HTTP/1.1", host: "localhost:10443", referrer: "https://localhost:10443/attach
"


When I pointed the error page at an invalid location (error_page 413
@bad_location) I got this instead:

2009/06/03 23:06:31 [error] 11885#0: *153 client intended to send too
large body: 995365 bytes, client: 192.168.98.223, server: localhost,
request: "POST /attach HTTP/1.1", host: "localhost:10443", referrer: "https://localhost:10443/attach
"
2009/06/03 23:06:31 [error] 11885#0: *153 could not find named
location "@bad_location", client: 192.168.98.223, server: localhost,
request: "POST /attach HTTP/1.1", host: "localhost:10443", referrer: "https://localhost:10443/attach
"

So what I think is happening is the initial request is made, which
eventually throws a NGX_HTTP_REQUEST_ENTITY_TOO_LARGE error, resulting
in the error page handler to run. It tries cleaning up the request
and resets it to an internal request for /err/413.html, but I think it
isn't cleaning everything up well enough. So when the error page tries
to load, it notices that the content length of the request is still
too large, and throws an error as well.

Does anyone have any idea how to fix this, or would like to submit a
patch? I'm going to try my best to fix the code, and if I can I'll
send a patch in to the mailing list. But my C skills aren't that
solid, and I'm unfamiliar with the nginx codebase.

Thank you, and I hope someone has a magic-bullet solution for this. :-)
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: 154
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