Support for POST client body sent with Transfer-Encoding: chunked

Carlos carloscm at gmail.com
Mon Feb 4 00:39:34 MSK 2008


In the process of switching from Apache 2 to an all-nginx setup for
front-end servers I have found a nginx (miss-)feature that makes it
impossible to service certain clients. Basically nginx will refuse to
serve POST requests that don't specify a Content-Length parameter and
use Transfer-Encoding: chunked for the POST client body. A 411 error
will be served every time such a request is received.

Setting up nginx as a proxy doesn't work either, the same 411 error is
served. It appears nginx is buffering the POST body and applies the
same limiting rules even for proxy_pass-ed requests.

I've looked in the code and it appears to be an explicit limitation
(ngx_http_process_request_header() function in ngx_http_request.c),
and the changelog mentions it as an actual "bugfix" (nginx 0.3.12).
I'm not an expert in technolegalese but it appears that TE:chunked
POST bodies is a HTTP 1.1 feature and there are actual products
sending such POST bodies, and I am pretty sure other servers that
Apache 2 support it too. Is there any technical explanation for nginx
not supporting, or at least explicitly disabling it? Anybody knows a
work-around for it? I guess the correct answer is "add the feature and
send a patch", but asking first to not reinvent any wheel won't hurt
:)

(The clients in question are J2ME phones. I can do my own HTTP client
for the few of them that expose TCP sockets to applications, but the
majority only allow high-level "HTTP connections" that don't expose
any socket internals or details about how the actual request is
formatted. Not all of them are doing TE:chunked POST but the ones that
do are very significant, for example the official Sun J2ME emulator.)

-- 
Carlos





More information about the nginx mailing list