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 NameFile Size Posted byDate 
patch.413530 bytesopen | downloadIgor Sysoev09/01/2009Read 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. :-)
SubjectAuthorPosted

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

Michael NachbaurJune 03, 2009 07:13PM

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

pvdbAugust 31, 2009 11:26AM

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

pvdbAugust 31, 2009 11:38AM

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

Igor SysoevAugust 31, 2009 12:22PM

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

pvdbAugust 31, 2009 01:25PM

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

Igor SysoevSeptember 02, 2009 05:49PM

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

estebistecJune 18, 2010 12:48PM

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

estebistecJune 23, 2010 06:49PM

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

Maxim DouninJune 20, 2010 07:28PM

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

estebistecJune 21, 2010 09:19AM

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

Maxim DouninJune 21, 2010 12:24PM

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

estebistecJune 21, 2010 09:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready