POST subrequest body doesn't get passed to fastcgi · Issue #8 · openresty/echo-nginx-module (original) (raw)

Hi,

Here is my config

location /hello {
default_type text/plain;
echo_subrequest POST '/test' -q 'foo=Foo&bar=baz' -b 'request_body=test&test=3';
}

location /test {
# default example works
#echo "querystring: $query_string";
#echo "method: $echo_request_method";
#echo "body: $echo_request_body";
#echo "content length: $http_content_length";
#echo '///';

fastcgi_pass   127.0.0.1:1234;
include        fastcgi_params;
fastcgi_param  SCRIPT_FILENAME  /root/test.php;

#deny all;

}

In test.php file I have this:

On echo $HTTP_RAW_POST_DATA; ?>

When I make a request with the default example I can see

curl 'http://localhost/hello'
querystring: foo=Foo&bar=baz
method: POST
body: request_body=test&test=3
content length: 24
///

When I make the same request with fastcgi I can see

curl 'http://localhost/hello'
Array
(
[foo] => Foo
[bar] => baz
)
Array
(
)

So, as you can see GET params are passed. No request_body or POST params though.

I expect it to output:
Array
(
[foo] => Foo
[bar] => baz
)
Array
(
[request_body] => test
[test] => 3
)
request_body=test&test=3

Is this a bug or it is by design?

I'm using v0.37 which comes with nginx 1.1.13.