Digging around I was able to get this code so far:
in my module's body filter I do this:
if(ngx_http_subrequest(r, &uri, &query_string, &sr, NULL, 0) != NGX_OK)
return NGX_ERROR;
// adjust subrequest
ngx_str_t method_name = ngx_string("POST");
sr->method = NGX_HTTP_POST;
sr->method_name = method_name;
First of all it still uses GET with fastcgi_pass. If I do proxy_pass instead the method is POST. I think it is a bug in fastcgi module. The above code should be OK so far, since it works with proxy_pass.
Now I don't know how to pass post data to subrequest. I have tried to create a buffer chain with sample data in it and using sr->request_body->bufs, however it doesn't work.
Am I right that if I populate sr->request_body->bufs they will be written to subrequest request body?