Nginx module dev help: nginx http subrequest of type POST (including POST params)

Hi nginx experts!
This is my first post in this forum - I’m hoping you folks can throw
some
light on a problem I’m facing.

I’m trying to develop a module very similar to the
ngx_http_auth_request_module
(Module ngx_http_auth_request_module). While seeing
the
source code, I realized that this uses ngx_http_subrequest to create a
subrequest to a server, and the implementation of ngx_http_subrequest
sets
the type of request to a GET:

sr->method = NGX_HTTP_GET;

My use case is this - I need a module that performs authentication based
on
the subrequest (identical to the module). HOWEVER, the subrequest should
include POST params (request body). This is required since the
authentication server (that the subrequest points to) will use something
like AWS’s signing technique
(Create a signed AWS API request - AWS Identity and Access Management) to
match
signatures. This technique hashes the request body and verifies the hash

hence I need the subrequest to include the request body too.

Is there any way I can achieve this? I cannot seem to figure out how
implement something like ngx_http_subrequest that would include POST
params.

Help please :slight_smile: !

Posted at Nginx Forum: