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

Pyry Hakulinen pyry at
Sat Aug 13 20:06:38 UTC 2011


> No, this is incorrect.  Body should be either read or discarded
> before response could be returned (else communication with clients
> which write body and only then read response will just deadlock).

Ah, indeed, I see what you mean. I didn't see it deadlock, but I
really didn't test it all that much. Thanks for looking.

> (I personally consider post_action to be a dirty hack which should
> be removed entirely, and it's not officially documented on purpose,
> but that's another story.)

Yeah, it looks like it isn't that reliable when used with POST
requests. For example, using this:

        location / {
            proxy_pass http://some.server;
            post_action @post;
        location @post {
                proxy_pass http://some.server;

post_action will fail when client request body is buffered to a temp
file. Can be "fixed" by increasing client_body_buffer_size or by
discarding request body in @post location (proxy_pass_request_body
off; proxy_set_header Content-Length 0;).

> In you particular case I would recommend actually using module to
> read body and return 202 response instead of using "return 202".

Thanks, this is probably what we will end up doing.


More information about the nginx mailing list