Problem with post_action when used with return 202; and POST request

Pyry Hakulinen pyry at
Wed Aug 10 11:18:41 UTC 2011


We are trying to use post_action in a location block that only has
"return 202;". Everything works fine for GET requests and with small
POST requests, but if the client request body + headers are over 1kB,
nginx will not trigger the post_action handler.

Test configuration, and debug log attached. Following commands can be
used to trigger the error:

dd if=/dev/zero of=request_body count=2
wget -d --post-file=request_body localhost:8022

Is this a bug or just the way it should work? I tested it with nginx
1.0.5 and 1.1.0, both appear to be working the same way.

I worked around it by creating a small module that just calls
ngx_http_read_client_request_body() and returns 202 from the callback.
But I feel that it might not be the right solution for this. (module
also attached)

Also while debugging I found another possibly related bug, if you do a
POST request against location / { return 202; } block, it will
incorrectly result in 2 lines in access log: - - [10/Aug/2011:14:07:40 +0300] "POST / HTTP/1.1" 202 0 "-"
"curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o
zlib/ libidn/1.18" - - [10/Aug/2011:14:07:40 +0300] "foobar=foo" 400 172 "-" "-"

Happy to provide more information if needed. Thanks,
-------------- next part --------------
worker_processes  1;
events {
    worker_connections  1024;
http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen 8024;
	    return 202;
    server {
        listen       8022;
        server_name  localhost;

        location / {
            return 202;
            post_action @post;
        location @post {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: broken.log
Type: text/x-log
Size: 8809 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ngx_http_ghetto_module.c
Type: text/x-csrc
Size: 2359 bytes
Desc: not available
URL: <>

More information about the nginx mailing list