Welcome! Log In Create A New Profile

Advanced

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

Pyry Hakulinen
August 10, 2011 07:24AM
Hi,

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:

127.0.0.1 - - [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/1.2.3.4 libidn/1.18"
127.0.0.1 - - [10/Aug/2011:14:07:40 +0300] "foobar=foo" 400 172 "-" "-"

Happy to provide more information if needed. Thanks,
Pyry
worker_processes 1;
events {
worker_connections 1024;
debug_connection 127.0.0.1;
}
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 {
proxy_pass http://127.0.0.1:8024;
}
}
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

Pyry Hakulinen August 10, 2011 07:24AM

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

Maxim Dounin August 10, 2011 07:12PM

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

Pyry Hakulinen August 11, 2011 07:40AM

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

Maxim Dounin August 12, 2011 03:48AM

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

Pyry Hakulinen August 13, 2011 04:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
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